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: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Pavankumar Kondeti 2010-12-16 14:32:25 +05:30 committed by Greg Kroah-Hartman
parent f4ce908447
commit daba58035a
1 changed files with 1 additions and 1 deletions

View File

@ -1047,9 +1047,9 @@ composite_unbind(struct usb_gadget *gadget)
kfree(cdev->req->buf);
usb_ep_free_request(gadget->ep0, cdev->req);
}
device_remove_file(&gadget->dev, &dev_attr_suspended);
kfree(cdev);
set_gadget_data(gadget, NULL);
device_remove_file(&gadget->dev, &dev_attr_suspended);
composite = NULL;
}