Commit ecc25a7f authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman

greybus: es1-ap-usb: don't use 'es1' after it is freed

greybus_remove_hd() will free memory allocated to 'es1' and so using it after
the routine has returned isn't right.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent bf2329fd
...@@ -293,6 +293,7 @@ static int check_urb_status(struct urb *urb) ...@@ -293,6 +293,7 @@ static int check_urb_status(struct urb *urb)
static void ap_disconnect(struct usb_interface *interface) static void ap_disconnect(struct usb_interface *interface)
{ {
struct es1_ap_dev *es1; struct es1_ap_dev *es1;
struct usb_device *udev;
int i; int i;
es1 = usb_get_intfdata(interface); es1 = usb_get_intfdata(interface);
...@@ -329,9 +330,10 @@ static void ap_disconnect(struct usb_interface *interface) ...@@ -329,9 +330,10 @@ static void ap_disconnect(struct usb_interface *interface)
es1->svc_buffer = NULL; es1->svc_buffer = NULL;
usb_set_intfdata(interface, NULL); usb_set_intfdata(interface, NULL);
udev = es1->usb_dev;
greybus_remove_hd(es1->hd); greybus_remove_hd(es1->hd);
usb_put_dev(es1->usb_dev); usb_put_dev(udev);
} }
/* Callback for when we get a SVC message */ /* Callback for when we get a SVC message */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment