Commit daba5803 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Greg Kroah-Hartman

USB: gadget: Remove suspended sysfs file before freeing cdev

cdev struct is accessed in suspended sysfs show function.  So
remove sysfs file before freeing the cdev in composite_unbind.
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f4ce9084
...@@ -1047,9 +1047,9 @@ composite_unbind(struct usb_gadget *gadget) ...@@ -1047,9 +1047,9 @@ composite_unbind(struct usb_gadget *gadget)
kfree(cdev->req->buf); kfree(cdev->req->buf);
usb_ep_free_request(gadget->ep0, cdev->req); usb_ep_free_request(gadget->ep0, cdev->req);
} }
device_remove_file(&gadget->dev, &dev_attr_suspended);
kfree(cdev); kfree(cdev);
set_gadget_data(gadget, NULL); set_gadget_data(gadget, NULL);
device_remove_file(&gadget->dev, &dev_attr_suspended);
composite = NULL; composite = NULL;
} }
......
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