Commit 5cfa245b authored by Julia Lawall's avatar Julia Lawall Committed by Len Brown

ACPI: Move dereference after NULL test

If the NULL test on pr is needed, then the dereference should be after the
NULL test.

A simplified version of the semantic match that detects this problem is as
follows (http://coccinelle.lip6.fr/):

// <smpl>
@match exists@
expression x, E;
identifier fld;
@@

* x->fld
  ... when != \(x = E\|&x\)
* x == NULL
// </smpl>
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 941b10fa
...@@ -1133,15 +1133,15 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) ...@@ -1133,15 +1133,15 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
int result = 0; int result = 0;
struct acpi_processor_throttling *pthrottling; struct acpi_processor_throttling *pthrottling;
if (!pr)
return -EINVAL;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
pr->throttling.address, pr->throttling.address,
pr->throttling.duty_offset, pr->throttling.duty_offset,
pr->throttling.duty_width)); pr->throttling.duty_width));
if (!pr)
return -EINVAL;
/* /*
* Evaluate _PTC, _TSS and _TPC * Evaluate _PTC, _TSS and _TPC
* They must all be present or none of them can be used. * They must all be present or none of them can be used.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment