mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] fujitsu-laptop: Correct redundant test
@ 2009-07-31  8:42 Jonathan Woithe
  2009-08-27 22:56 ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Woithe @ 2009-07-31  8:42 UTC (permalink / raw)
  To: linux-acpi
  Cc: Jonathan Woithe, linux-kernel, julia, bzolnier, kernel-janitors

From: Julia Lawall <julia@diku.dk>

device and acpi_driver_data(device) were tested just a few lines above.

A simplified version of the semantic match that finds this problem is as
follows: (http://www.emn.fr/x-info/coccinelle/)

// <smpl> 
@r exists@
local idexpression x;
expression E;
@@

if (x == NULL || ...) { ... when forall
   return ...; }
.. when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\)
(
*x == NULL
|
*x != NULL
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>

--- a/drivers/platform/x86/fujitsu-laptop.c	2009-07-31 16:55:09.389775000 +0930
+++ b/drivers/platform/x86/fujitsu-laptop.c	2009-07-31 17:13:01.160777027 +0930
@@ -745,9 +745,6 @@ static int acpi_fujitsu_remove(struct ac
 
 	fujitsu = acpi_driver_data(device);
 
-	if (!device || !acpi_driver_data(device))
-		return -EINVAL;
-
 	fujitsu->acpi_handle = NULL;
 
 	return 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-27 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-31  8:42 [PATCH 1/4] fujitsu-laptop: Correct redundant test Jonathan Woithe
2009-08-27 22:56 ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®