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: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
Viresh Kumar 2014-11-24 09:25:24 +05:30 committed by Greg Kroah-Hartman
parent bf2329fd7d
commit ecc25a7f58
1 changed files with 3 additions and 1 deletions

View File

@ -293,6 +293,7 @@ static int check_urb_status(struct urb *urb)
static void ap_disconnect(struct usb_interface *interface)
{
struct es1_ap_dev *es1;
struct usb_device *udev;
int i;
es1 = usb_get_intfdata(interface);
@ -329,9 +330,10 @@ static void ap_disconnect(struct usb_interface *interface)
es1->svc_buffer = NULL;
usb_set_intfdata(interface, NULL);
udev = es1->usb_dev;
greybus_remove_hd(es1->hd);
usb_put_dev(es1->usb_dev);
usb_put_dev(udev);
}
/* Callback for when we get a SVC message */