Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b55fa2d authored by Adrian Bunk's avatar Adrian Bunk Committed by Greg Kroah-Hartman
Browse files

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



NULL checks should be before the first dereference.

Spotted by the Coverity checker.

Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f81ee4d5
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -1047,13 +1047,10 @@ static void gtco_disconnect(struct usb_interface *interface)


	/* Grab private device ptr */
	/* Grab private device ptr */
	struct gtco    *device = usb_get_intfdata (interface);
	struct gtco    *device = usb_get_intfdata (interface);
	struct input_dev *inputdev;

	inputdev = device->inputdevice;


	/* Now reverse all the registration stuff */
	/* Now reverse all the registration stuff */
	if (device) {
	if (device) {
		input_unregister_device(inputdev);
		input_unregister_device(device->inputdevice);
		usb_kill_urb(device->urbinfo);
		usb_kill_urb(device->urbinfo);
		usb_free_urb(device->urbinfo);
		usb_free_urb(device->urbinfo);
		usb_buffer_free(device->usbdev, REPORT_MAX_SIZE,
		usb_buffer_free(device->usbdev, REPORT_MAX_SIZE,