Skip to content

Commit

Permalink
USB: gadget: Remove suspended sysfs file before freeing cdev
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pavankumar Kondeti authored and Greg Kroah-Hartman committed Dec 16, 2010
1 parent f4ce908 commit daba580
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/gadget/composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit daba580

Please sign in to comment.