aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanjun Guo <hanjun.guo@linaro.org>2015-02-05 04:33:14 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-02-05 19:34:47 -0500
commit2fad93083e288a7d24bf7284c87f0d80a5a2c599 (patch)
treebf244bbd5cf4033bf07b5cce08562f1b4d779bd1
parente36f014edff70fc02b3d3d79cead1d58f289332e (diff)
ACPI / table: remove duplicate NULL check for the handler of acpi_table_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>
-rw-r--r--arch/ia64/kernel/acpi.c6
-rw-r--r--arch/x86/kernel/acpi/boot.c16
-rw-r--r--drivers/acpi/numa.c12
3 files changed, 4 insertions, 30 deletions
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index e795cb848154..2c4498919d3c 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -380,9 +380,6 @@ static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
380 380
381static int __init acpi_parse_madt(struct acpi_table_header *table) 381static int __init acpi_parse_madt(struct acpi_table_header *table)
382{ 382{
383 if (!table)
384 return -EINVAL;
385
386 acpi_madt = (struct acpi_table_madt *)table; 383 acpi_madt = (struct acpi_table_madt *)table;
387 384
388 acpi_madt_rev = acpi_madt->header.revision; 385 acpi_madt_rev = acpi_madt->header.revision;
@@ -645,9 +642,6 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
645 struct acpi_table_header *fadt_header; 642 struct acpi_table_header *fadt_header;
646 struct acpi_table_fadt *fadt; 643 struct acpi_table_fadt *fadt;
647 644
648 if (!table)
649 return -EINVAL;
650
651 fadt_header = (struct acpi_table_header *)table; 645 fadt_header = (struct acpi_table_header *)table;
652 if (fadt_header->revision != 3) 646 if (fadt_header->revision != 3)
653 return -ENODEV; /* Only deal with ACPI 2.0 FADT */ 647 return -ENODEV; /* Only deal with ACPI 2.0 FADT */
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index b9e30daa0881..14d3652ece8d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -843,13 +843,7 @@ int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base)
843 843
844static int __init acpi_parse_sbf(struct acpi_table_header *table) 844static int __init acpi_parse_sbf(struct acpi_table_header *table)
845{ 845{
846 struct acpi_table_boot *sb; 846 struct acpi_table_boot *sb = (struct acpi_table_boot *)table;
847
848 sb = (struct acpi_table_boot *)table;
849 if (!sb) {
850 printk(KERN_WARNING PREFIX "Unable to map SBF\n");
851 return -ENODEV;
852 }
853 847
854 sbf_port = sb->cmos_index; /* Save CMOS port */ 848 sbf_port = sb->cmos_index; /* Save CMOS port */
855 849
@@ -863,13 +857,7 @@ static struct resource *hpet_res __initdata;
863 857
864static int __init acpi_parse_hpet(struct acpi_table_header *table) 858static int __init acpi_parse_hpet(struct acpi_table_header *table)
865{ 859{
866 struct acpi_table_hpet *hpet_tbl; 860 struct acpi_table_hpet *hpet_tbl = (struct acpi_table_hpet *)table;
867
868 hpet_tbl = (struct acpi_table_hpet *)table;
869 if (!hpet_tbl) {
870 printk(KERN_WARNING PREFIX "Unable to map HPET\n");
871 return -ENODEV;
872 }
873 861
874 if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) { 862 if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) {
875 printk(KERN_WARNING PREFIX "HPET timers must be located in " 863 printk(KERN_WARNING PREFIX "HPET timers must be located in "
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 24b5476449a1..1333cbdc3ea2 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -177,12 +177,7 @@ static int __init slit_valid(struct acpi_table_slit *slit)
177 177
178static int __init acpi_parse_slit(struct acpi_table_header *table) 178static int __init acpi_parse_slit(struct acpi_table_header *table)
179{ 179{
180 struct acpi_table_slit *slit; 180 struct acpi_table_slit *slit = (struct acpi_table_slit *)table;
181
182 if (!table)
183 return -EINVAL;
184
185 slit = (struct acpi_table_slit *)table;
186 181
187 if (!slit_valid(slit)) { 182 if (!slit_valid(slit)) {
188 printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n"); 183 printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
@@ -260,11 +255,8 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header,
260 255
261static int __init acpi_parse_srat(struct acpi_table_header *table) 256static int __init acpi_parse_srat(struct acpi_table_header *table)
262{ 257{
263 struct acpi_table_srat *srat; 258 struct acpi_table_srat *srat = (struct acpi_table_srat *)table;
264 if (!table)
265 return -EINVAL;
266 259
267 srat = (struct acpi_table_srat *)table;
268 acpi_srat_revision = srat->header.revision; 260 acpi_srat_revision = srat->header.revision;
269 261
270 /* Real work done in acpi_table_parse_srat below. */ 262 /* Real work done in acpi_table_parse_srat below. */