Skip to contentSkip to conversation

usbat_check_status(): fix check-after-use

PATCH In review Adrian Bunk 2 participants 2 messages Jul 30, 2007 – Jul 31, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usbat_check_status(): fix check-after-use

The Coverity checker spotted that we have already oops'ed if "us" was NULL.

Since "us" can't be NULL in the only caller this patch removes the NULL check.

---

drivers/usb/storage/shuttle_usbat.c renamed from drivers/usb/storage/shuttle_usbat.c.old +0 -3
@@ -190,9 +190,6 @@ static int usbat_check_status(struct us_
 	unsigned char *reply = us->iobuf;
 	int rc;
 
-	if (!us)
-		return USB_STOR_TRANSPORT_ERROR;
-
 	rc = usbat_get_status(us, reply);
 	if (rc != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_FAILED;
#1 lore raw
Quoted 21 lines · Adrian Bunk

The Coverity checker spotted that we have already oops'ed if "us" was NULL.

Since "us" can't be NULL in the only caller this patch removes the NULL check.

---

drivers/usb/storage/shuttle_usbat.c renamed from drivers/usb/storage/shuttle_usbat.c.old +0 -3
@@ -190,9 +190,6 @@ static int usbat_check_status(struct us_
 	unsigned char *reply = us->iobuf;
 	int rc;
 
-	if (!us)
-		return USB_STOR_TRANSPORT_ERROR;
-
 	rc = usbat_get_status(us, reply);
 	if (rc != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_FAILED;
Signature · 6 lines
Matthew Dharm                              Home: [email protected] 
Maintainer, Linux USB Mass Storage Driver

I need a computer?
					-- Customer
User Friendly, 2/19/1998