mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
usb: gadget: udc: do not clear gadget driver.bus
Before the commitfc274c1e99
("USB: gadget: Add a new bus for gadgets") gadget driver.bus was unused. For whatever reason, many UDC drivers set this field explicitly to NULL in udc_start(). With the newly added gadget bus, doing this will crash the driver during the attach. The problem was first reported, fixed and tested with OMAP UDC and g_ether. Other drivers are changed based on code analysis only. Fixes:fc274c1e99
("USB: gadget: Add a new bus for gadgets") Cc: stable <stable@kernel.org> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Acked-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/20230201220125.GD2415@darkstar.musicnaut.iki.fi Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
2fa89458af
commit
30d09b3131
@ -1014,7 +1014,6 @@ static int fotg210_udc_start(struct usb_gadget *g,
|
||||
int ret;
|
||||
|
||||
/* hook up the driver */
|
||||
driver->driver.bus = NULL;
|
||||
fotg210->driver = driver;
|
||||
|
||||
if (!IS_ERR_OR_NULL(fotg210->phy)) {
|
||||
|
@ -1830,7 +1830,6 @@ static int bcm63xx_udc_start(struct usb_gadget *gadget,
|
||||
bcm63xx_select_phy_mode(udc, true);
|
||||
|
||||
udc->driver = driver;
|
||||
driver->driver.bus = NULL;
|
||||
udc->gadget.dev.of_node = udc->dev->of_node;
|
||||
|
||||
spin_unlock_irqrestore(&udc->lock, flags);
|
||||
|
@ -2285,7 +2285,6 @@ static int fsl_qe_start(struct usb_gadget *gadget,
|
||||
/* lock is needed but whether should use this lock or another */
|
||||
spin_lock_irqsave(&udc->lock, flags);
|
||||
|
||||
driver->driver.bus = NULL;
|
||||
/* hook up the driver */
|
||||
udc->driver = driver;
|
||||
udc->gadget.speed = driver->max_speed;
|
||||
|
@ -1943,7 +1943,6 @@ static int fsl_udc_start(struct usb_gadget *g,
|
||||
/* lock is needed but whether should use this lock or another */
|
||||
spin_lock_irqsave(&udc_controller->lock, flags);
|
||||
|
||||
driver->driver.bus = NULL;
|
||||
/* hook up the driver */
|
||||
udc_controller->driver = driver;
|
||||
spin_unlock_irqrestore(&udc_controller->lock, flags);
|
||||
|
@ -1311,7 +1311,6 @@ static int fusb300_udc_start(struct usb_gadget *g,
|
||||
struct fusb300 *fusb300 = to_fusb300(g);
|
||||
|
||||
/* hook up the driver */
|
||||
driver->driver.bus = NULL;
|
||||
fusb300->driver = driver;
|
||||
|
||||
return 0;
|
||||
|
@ -1375,7 +1375,6 @@ static int goku_udc_start(struct usb_gadget *g,
|
||||
struct goku_udc *dev = to_goku_udc(g);
|
||||
|
||||
/* hook up the driver */
|
||||
driver->driver.bus = NULL;
|
||||
dev->driver = driver;
|
||||
|
||||
/*
|
||||
|
@ -1906,7 +1906,6 @@ static int gr_udc_start(struct usb_gadget *gadget,
|
||||
spin_lock(&dev->lock);
|
||||
|
||||
/* Hook up the driver */
|
||||
driver->driver.bus = NULL;
|
||||
dev->driver = driver;
|
||||
|
||||
/* Get ready for host detection */
|
||||
|
@ -1454,7 +1454,6 @@ static int m66592_udc_start(struct usb_gadget *g,
|
||||
struct m66592 *m66592 = to_m66592(g);
|
||||
|
||||
/* hook up the driver */
|
||||
driver->driver.bus = NULL;
|
||||
m66592->driver = driver;
|
||||
|
||||
m66592_bset(m66592, M66592_VBSE | M66592_URST, M66592_INTENB0);
|
||||
|
@ -1108,7 +1108,6 @@ static int max3420_udc_start(struct usb_gadget *gadget,
|
||||
|
||||
spin_lock_irqsave(&udc->lock, flags);
|
||||
/* hook up the driver */
|
||||
driver->driver.bus = NULL;
|
||||
udc->driver = driver;
|
||||
udc->gadget.speed = USB_SPEED_FULL;
|
||||
|
||||
|
@ -1243,7 +1243,6 @@ static int mv_u3d_start(struct usb_gadget *g,
|
||||
}
|
||||
|
||||
/* hook up the driver ... */
|
||||
driver->driver.bus = NULL;
|
||||
u3d->driver = driver;
|
||||
|
||||
u3d->ep0_dir = USB_DIR_OUT;
|
||||
|
@ -1359,7 +1359,6 @@ static int mv_udc_start(struct usb_gadget *gadget,
|
||||
spin_lock_irqsave(&udc->lock, flags);
|
||||
|
||||
/* hook up the driver ... */
|
||||
driver->driver.bus = NULL;
|
||||
udc->driver = driver;
|
||||
|
||||
udc->usb_state = USB_STATE_ATTACHED;
|
||||
|
@ -1451,7 +1451,6 @@ static int net2272_start(struct usb_gadget *_gadget,
|
||||
dev->ep[i].irqs = 0;
|
||||
/* hook up the driver ... */
|
||||
dev->softconnect = 1;
|
||||
driver->driver.bus = NULL;
|
||||
dev->driver = driver;
|
||||
|
||||
/* ... then enable host detection and ep0; and we're ready
|
||||
|
@ -2423,7 +2423,6 @@ static int net2280_start(struct usb_gadget *_gadget,
|
||||
dev->ep[i].irqs = 0;
|
||||
|
||||
/* hook up the driver ... */
|
||||
driver->driver.bus = NULL;
|
||||
dev->driver = driver;
|
||||
|
||||
retval = device_create_file(&dev->pdev->dev, &dev_attr_function);
|
||||
|
@ -2066,7 +2066,6 @@ static int omap_udc_start(struct usb_gadget *g,
|
||||
udc->softconnect = 1;
|
||||
|
||||
/* hook up the driver */
|
||||
driver->driver.bus = NULL;
|
||||
udc->driver = driver;
|
||||
spin_unlock_irqrestore(&udc->lock, flags);
|
||||
|
||||
|
@ -2908,7 +2908,6 @@ static int pch_udc_start(struct usb_gadget *g,
|
||||
{
|
||||
struct pch_udc_dev *dev = to_pch_udc(g);
|
||||
|
||||
driver->driver.bus = NULL;
|
||||
dev->driver = driver;
|
||||
|
||||
/* get ready for ep0 traffic */
|
||||
|
@ -1933,7 +1933,6 @@ static int amd5536_udc_start(struct usb_gadget *g,
|
||||
struct udc *dev = to_amd5536_udc(g);
|
||||
u32 tmp;
|
||||
|
||||
driver->driver.bus = NULL;
|
||||
dev->driver = driver;
|
||||
|
||||
/* Some gadget drivers use both ep0 directions.
|
||||
|
Loading…
Reference in New Issue
Block a user