Skip to contentSkip to conversation

move null check earlier

PATCH In review Dan Carpenter 2 participants 2 messages Nov 10, 2009 – Dec 9, 2009 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 move null check earlier

I moved the null dereference after the check. It is unlikely to make any difference, but it's the right thing to do and it makes my static checker happy.

regards,
dan carpenter

drivers/acpi/processor_throttling.c +3 -3
@@ -1133,15 +1133,15 @@
 	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.
reviewer
#1 lore raw

Julia's patch to fix this shipped in Linux-2.6.32-rc7

cheers,
Len Brown, Intel Open Source Technology Center

Quoted 35 lines · Dan Carpenter

I moved the null dereference after the check. It is unlikely to make any difference, but it's the right thing to do and it makes my static checker happy.

regards,
dan carpenter

drivers/acpi/processor_throttling.c +3 -4
@@ -1133,15 +1133,15 @@
 	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.
--

To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html