Skip to contentSkip to conversation

drivers/usb/image/* - compile warning cleanup

PATCH In review Stephen Biggs 2 participants 4 messages Feb 10, 2005

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

PATCH 18/26 drivers/usb/image/* - compile warning cleanup

Description: handle error return from scsi_add_host

drivers/usb/image/microtek.c +5 -1
diff -Nurdp -X dontdiff-osdl linux-2.6.11-rc3-mm-original/drivers/usb/image/microtek.c linux-2.6.11-rc3-mm/drivers/usb/image/microtek.c
@@ -809,7 +809,11 @@ static int mts_usb_probe(struct usb_inte
 		goto out_free_urb;
 
 	new_desc->host->hostdata[0] = (unsigned long)new_desc;
-	scsi_add_host(new_desc->host, NULL); /* XXX handle failure */
+	if(scsi_add_host(new_desc->host, NULL)) {
+		usb_free_urb(new_desc->urb);
+		kfree(new_desc);
+		return -EIO;
+	}
 	scsi_scan_host(new_desc->host);
 
 	usb_set_intfdata(intf, new_desc);

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

drivers/usb/image/microtek.c static int mts_usb_probe(struct usb_inte · line 816

Quoted 12 lines · Stephen Biggs
drivers/usb/image/microtek.c +5 -1
@@ -809,7 +809,11 @@ static int mts_usb_probe(struct usb_inte
 		goto out_free_urb;
 
 	new_desc->host->hostdata[0] = (unsigned long)new_desc;
-	scsi_add_host(new_desc->host, NULL); /* XXX handle failure */
+	if(scsi_add_host(new_desc->host, NULL)) {
+		usb_free_urb(new_desc->urb);
+		kfree(new_desc);
+		return -EIO;
+	}

Should be:

	if (scsi_add_host(new_desc->host, NULL)) {
		rc = -E____;
		goto out_free_urb;
	}

Yes, yes, I know. There is no rc in mts_usb_probe. ;-)

Alexey

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Stephen Biggs
Quoted 17 lines · Alexey Dobriyan

drivers/usb/image/microtek.c static int mts_usb_probe(struct usb_inte · line 816

Quoted 12 lines · Stephen Biggs
drivers/usb/image/microtek.c +5 -1
@@ -809,7 +809,11 @@ static int mts_usb_probe(struct usb_inte
 		goto out_free_urb;
 
 	new_desc->host->hostdata[0] = (unsigned long)new_desc;
-	scsi_add_host(new_desc->host, NULL); /* XXX handle failure */
+	if(scsi_add_host(new_desc->host, NULL)) {
+		usb_free_urb(new_desc->urb);
+		kfree(new_desc);
+		return -EIO;
+	}

Should be:

Quoted 6 lines
	if (scsi_add_host(new_desc->host, NULL)) {
		rc = -E____;
		goto out_free_urb;
	}

Yes, yes, I know. There is no rc in mts_usb_probe. ;-)

This is why I didn't do it your way. I made the judgement call of not adding another patch line and an rc variable that would either only be used in one place, or I would have change the entire function to use "rc" consistently. My patch is, instead, a deletion of one line and an addition of 5 lines all in one place; simple.

Thanks for the feedback.

Quoted 3 lines

Alexey

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Stephen Biggs
Quoted 17 lines · Alexey Dobriyan

drivers/usb/image/microtek.c static int mts_usb_probe(struct usb_inte · line 816

Quoted 12 lines · Stephen Biggs
drivers/usb/image/microtek.c +5 -1
@@ -809,7 +809,11 @@ static int mts_usb_probe(struct usb_inte
 		goto out_free_urb;
 
 	new_desc->host->hostdata[0] = (unsigned long)new_desc;
-	scsi_add_host(new_desc->host, NULL); /* XXX handle failure */
+	if(scsi_add_host(new_desc->host, NULL)) {
+		usb_free_urb(new_desc->urb);
+		kfree(new_desc);
+		return -EIO;
+	}

Should be:

Quoted 6 lines
	if (scsi_add_host(new_desc->host, NULL)) {
		rc = -E____;
		goto out_free_urb;
	}

Yes, yes, I know. There is no rc in mts_usb_probe. ;-)

This is why I didn't do it your way. I made the judgement call of not adding another patch line and an rc variable that would either only be used in one place, or I would have change the entire function to use "rc" consistently. My patch is, instead, a deletion of one line and an addition of 5 lines all in one place; simple.

Thanks for the feedback.

Quoted 3 lines

Alexey

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors