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>
static void ap_disconnect(struct usb_interface *interface)
{
struct es1_ap_dev *es1;
+ struct usb_device *udev;
int i;
es1 = usb_get_intfdata(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 */