Skip to content

Commit

Permalink
ACPI / table: remove duplicate NULL check for the handler of acpi_tab…
Browse files Browse the repository at this point in the history
…le_parse()

In acpi_table_parse(), pointer of the table to pass to handler() is
checked before handler() called, so remove all the duplicate NULL
check in the handler function.

CC: Tony Luck <tony.luck@intel.com>
CC: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
hanjun-guo authored and rafaeljw committed Feb 6, 2015
1 parent e36f014 commit 2fad930
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
6 changes: 0 additions & 6 deletions arch/ia64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,6 @@ static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)

static int __init acpi_parse_madt(struct acpi_table_header *table)
{
if (!table)
return -EINVAL;

acpi_madt = (struct acpi_table_madt *)table;

acpi_madt_rev = acpi_madt->header.revision;
Expand Down Expand Up @@ -645,9 +642,6 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
struct acpi_table_header *fadt_header;
struct acpi_table_fadt *fadt;

if (!table)
return -EINVAL;

fadt_header = (struct acpi_table_header *)table;
if (fadt_header->revision != 3)
return -ENODEV; /* Only deal with ACPI 2.0 FADT */
Expand Down
16 changes: 2 additions & 14 deletions arch/x86/kernel/acpi/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,13 +843,7 @@ int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base)

static int __init acpi_parse_sbf(struct acpi_table_header *table)
{
struct acpi_table_boot *sb;

sb = (struct acpi_table_boot *)table;
if (!sb) {
printk(KERN_WARNING PREFIX "Unable to map SBF\n");
return -ENODEV;
}
struct acpi_table_boot *sb = (struct acpi_table_boot *)table;

sbf_port = sb->cmos_index; /* Save CMOS port */

Expand All @@ -863,13 +857,7 @@ static struct resource *hpet_res __initdata;

static int __init acpi_parse_hpet(struct acpi_table_header *table)
{
struct acpi_table_hpet *hpet_tbl;

hpet_tbl = (struct acpi_table_hpet *)table;
if (!hpet_tbl) {
printk(KERN_WARNING PREFIX "Unable to map HPET\n");
return -ENODEV;
}
struct acpi_table_hpet *hpet_tbl = (struct acpi_table_hpet *)table;

if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) {
printk(KERN_WARNING PREFIX "HPET timers must be located in "
Expand Down
12 changes: 2 additions & 10 deletions drivers/acpi/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,7 @@ static int __init slit_valid(struct acpi_table_slit *slit)

static int __init acpi_parse_slit(struct acpi_table_header *table)
{
struct acpi_table_slit *slit;

if (!table)
return -EINVAL;

slit = (struct acpi_table_slit *)table;
struct acpi_table_slit *slit = (struct acpi_table_slit *)table;

if (!slit_valid(slit)) {
printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
Expand Down Expand Up @@ -260,11 +255,8 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header,

static int __init acpi_parse_srat(struct acpi_table_header *table)
{
struct acpi_table_srat *srat;
if (!table)
return -EINVAL;
struct acpi_table_srat *srat = (struct acpi_table_srat *)table;

srat = (struct acpi_table_srat *)table;
acpi_srat_revision = srat->header.revision;

/* Real work done in acpi_table_parse_srat below. */
Expand Down

0 comments on commit 2fad930

Please sign in to comment.