diff options
author | Julia Lawall <julia@diku.dk> | 2009-07-19 11:29:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-23 09:46:29 -0400 |
commit | 64aebe73152ab3a9f5f426baaf65db632bd72c13 (patch) | |
tree | b96e307aed23b98bd83c1096da8619e0d042849d | |
parent | 981e60f037631ca725a9790e7b3512de4a60bba8 (diff) |
USB: storage: Drop an unneeded a NULL test
In each case, the NULL test is not necessary because the function is static
and at the only places where it is called, the us argument has already been
dereferenced.
The semantic patch that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@
type T;
expression E,E1;
identifier i,fld;
statement S;
@@
- T i = E->fld;
+ T i;
... when != E=E1
when != i
if (E == NULL||...) S
+ i = E->fld;
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/storage/datafab.c | 4 | ||||
-rw-r--r-- | drivers/usb/storage/jumpshot.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index 2b6e565262c2..ded836b02d7b 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c | |||
@@ -334,7 +334,7 @@ static int datafab_determine_lun(struct us_data *us, | |||
334 | unsigned char *buf; | 334 | unsigned char *buf; |
335 | int count = 0, rc; | 335 | int count = 0, rc; |
336 | 336 | ||
337 | if (!us || !info) | 337 | if (!info) |
338 | return USB_STOR_TRANSPORT_ERROR; | 338 | return USB_STOR_TRANSPORT_ERROR; |
339 | 339 | ||
340 | memcpy(command, scommand, 8); | 340 | memcpy(command, scommand, 8); |
@@ -399,7 +399,7 @@ static int datafab_id_device(struct us_data *us, | |||
399 | unsigned char *reply; | 399 | unsigned char *reply; |
400 | int rc; | 400 | int rc; |
401 | 401 | ||
402 | if (!us || !info) | 402 | if (!info) |
403 | return USB_STOR_TRANSPORT_ERROR; | 403 | return USB_STOR_TRANSPORT_ERROR; |
404 | 404 | ||
405 | if (info->lun == -1) { | 405 | if (info->lun == -1) { |
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 1c69420e3acf..6168596c5ac6 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c | |||
@@ -335,7 +335,7 @@ static int jumpshot_id_device(struct us_data *us, | |||
335 | unsigned char *reply; | 335 | unsigned char *reply; |
336 | int rc; | 336 | int rc; |
337 | 337 | ||
338 | if (!us || !info) | 338 | if (!info) |
339 | return USB_STOR_TRANSPORT_ERROR; | 339 | return USB_STOR_TRANSPORT_ERROR; |
340 | 340 | ||
341 | command[0] = 0xE0; | 341 | command[0] = 0xE0; |