From: Adrian Bunk <bunk@stusta.de>
Date: Mon, 19 Mar 2007 09:26:32 +0000 (+0100)
Subject: USB: gtco.c: fix a use-before-check
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1b55fa2d430d6c708d3e5efbc6134be4a0c32b15;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git

USB: gtco.c: fix a use-before-check

NULL checks should be before the first dereference.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---

diff --git a/drivers/usb/input/gtco.c b/drivers/usb/input/gtco.c
index 203cdc1bbba4..ae756e0afc99 100644
--- a/drivers/usb/input/gtco.c
+++ b/drivers/usb/input/gtco.c
@@ -1047,13 +1047,10 @@ static void gtco_disconnect(struct usb_interface *interface)
 
 	/* 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,