From: Felipe Balbi Date: Thu, 8 Sep 2011 11:12:18 +0000 (+0300) Subject: usb: gadget: udc-core: fix bug on soft_connect interface X-Git-Tag: firefly_0821_release~3680^2~4327^2~135 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=865569ba5a8b0cc840e2b9c16ca6b42d6d5306b4;p=firefly-linux-kernel-4.4.55.git usb: gadget: udc-core: fix bug on soft_connect interface We should not be using dev_get_drvdata() because we never call dev_set_drvdata(). Let's use container_of() as all other sysfs attributes. Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 5e77a46a429a..022baeca7c94 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c @@ -356,7 +356,7 @@ static DEVICE_ATTR(srp, S_IWUSR, NULL, usb_udc_srp_store); static ssize_t usb_udc_softconn_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t n) { - struct usb_udc *udc = dev_get_drvdata(dev); + struct usb_udc *udc = container_of(dev, struct usb_udc, dev); if (sysfs_streq(buf, "connect")) { usb_gadget_connect(udc->gadget);