From ecc25a7f58d9be842f591800f13f932396fb72af Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Mon, 24 Nov 2014 09:25:24 +0530 Subject: [PATCH] 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/es1-ap-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/es1-ap-usb.c b/drivers/staging/greybus/es1-ap-usb.c index bab6f259dd70..204784329716 100644 --- a/drivers/staging/greybus/es1-ap-usb.c +++ b/drivers/staging/greybus/es1-ap-usb.c @@ -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 */ -- 2.39.5