summaryrefslogtreecommitdiff
path: root/drivers/acpi/processor_throttling.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-10-17 08:34:39 +0200
committerLen Brown <len.brown@intel.com>2009-11-05 17:30:57 -0500
commit5cfa245b0b63c3d79568e78a1ee3d00654d5517d (patch)
tree161590c73691e744b176decedd41504d4de6f4c4 /drivers/acpi/processor_throttling.c
parent941b10fab2cbd90ac7ad6bc2338ffe30e1d3ce53 (diff)
downloadlwn-5cfa245b0b63c3d79568e78a1ee3d00654d5517d.tar.gz
lwn-5cfa245b0b63c3d79568e78a1ee3d00654d5517d.zip
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: Julia Lawall <julia@diku.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/processor_throttling.c')
-rw-r--r--drivers/acpi/processor_throttling.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index 4c6c14c1e307..1c5d7a8b2fdf 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -1133,15 +1133,15 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr)
int result = 0;
struct acpi_processor_throttling *pthrottling;
+ if (!pr)
+ return -EINVAL;
+
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n",
pr->throttling.address,
pr->throttling.duty_offset,
pr->throttling.duty_width));
- if (!pr)
- return -EINVAL;
-
/*
* Evaluate _PTC, _TSS and _TPC
* They must all be present or none of them can be used.