public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] drivers/usb/input/gtco.c: fix a use-before-check
@ 2007-03-19  9:26 Adrian Bunk
  0 siblings, 0 replies; only message in thread
From: Adrian Bunk @ 2007-03-19  9:26 UTC (permalink / raw)
  To: Jeremy A. Roberson, Greg Kroah-Hartman; +Cc: linux-kernel, linux-usb-devel

NULL checks should be before the first dereference.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---
--- linux-2.6.21-rc3-mm2/drivers/usb/input/gtco.c.old	2007-03-19 09:29:44.000000000 +0100
+++ linux-2.6.21-rc3-mm2/drivers/usb/input/gtco.c	2007-03-19 09:30:31.000000000 +0100
@@ -1047,13 +1047,10 @@ static void gtco_disconnect(struct usb_i
 
 	/* Grab private device ptr */
 	struct gtco    *device = usb_get_intfdata (interface);
-	struct input_dev *inputdev;
-
-	inputdev = device->inputdevice;
 
 	/* Now reverse all the registration stuff */
 	if (device) {
-		input_unregister_device(inputdev);
+		input_unregister_device(device->inputdevice);
 		usb_kill_urb(device->urbinfo);
 		usb_free_urb(device->urbinfo);
 		usb_buffer_free(device->usbdev, REPORT_MAX_SIZE,


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-19  9:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-19  9:26 [2.6 patch] drivers/usb/input/gtco.c: fix a use-before-check Adrian Bunk

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