Skip to content

Commit

Permalink
fujitsu-laptop: Correct redundant test
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Julia Lawall authored and Len Brown committed Aug 28, 2009
1 parent 1e384cb commit 14485c5
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions drivers/platform/x86/fujitsu-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,6 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type)

fujitsu = acpi_driver_data(device);

if (!device || !acpi_driver_data(device))
return -EINVAL;

fujitsu->acpi_handle = NULL;

return 0;
Expand Down

0 comments on commit 14485c5

Please sign in to comment.