usb: fixes for v3.19-rc5

Just three fixes this time. An oops fix in ep_write() from gadgetfs,
 another oops for the Atmel UDC when unloading a gadget driver and
 the fix for PHY deferred probing.
 
 Signed-off-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUtAxnAAoJEIaOsuA1yqRErBcP/RzyenZEkuw8A6nNbGHmAi8p
 eYYRPfWDdVLFyouvDcSevz2YR6PTviRfuTUu45yFlMLPQLOY00IQtwy4F+DTCB3A
 Ce0QUVFTvzvXbyHteG5VaYIWvDtJQnXrhTjv8XVsvW/UXtbzCE0RWWtNGbKsvCv8
 WRj/nFqymkCYhB1qqy/2b8Kdp1k8e/m1RzvaNusBaWzu73ejExme338tx6vfepQi
 MSjguviCAybSgbbZbvDGfd0D1LVDnrS78gLGm/JGGU1M+mcOnv3EGY00bgnlCB9o
 ydNIL+UkQTNTi6qrJQxNomwKexF9QkCrrKazMLA8lunTIt7yYuvxes01DZuLrSuN
 4vXjMlyiDFjtu7tA4Fe/k1rCPwRmpKQlr2uqcMcExcSeDJ7zwsUNYsFyzDnk1JMx
 nPmcuyCkP/S8QNY6w4LqcTb++cTKdH5A73nVoVHaPA5DUEAcmyMFdwm8N/R9V+PX
 yvzpPwAtkLeJPkjJwt0Bg6jcJ+FfNAfnXXrIHxFYXcKnud2VmqYtSJNMhrwdbdAh
 WG/jsdCtRJFAoMZzNEEPzFwQU+UW0c9ux9+jhzKFV1ognzqQALlREc5dGK2qoxDt
 5yWXqD6EymsWMLKo6vuYmIzoR5WXzIdzjgSvTJQNqEafCUMBAhIRKUxq4IVoX95d
 mwxe5ePPjww1tIM+8fjs
 =7Fj7
 -----END PGP SIGNATURE-----

Merge tag 'fixes-for-v3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

usb: fixes for v3.19-rc5

Just three fixes this time. An oops fix in ep_write() from gadgetfs,
another oops for the Atmel UDC when unloading a gadget driver and
the fix for PHY deferred probing.

Signed-off-by: Felipe Balbi <balbi@ti.com>

Conflicts:
	drivers/usb/phy/phy.c
This commit is contained in:
Greg Kroah-Hartman 2015-01-12 10:51:04 -08:00
commit 06087cb42d
3 changed files with 21 additions and 4 deletions

View File

@ -441,6 +441,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
kbuf = memdup_user(buf, len); kbuf = memdup_user(buf, len);
if (IS_ERR(kbuf)) { if (IS_ERR(kbuf)) {
value = PTR_ERR(kbuf); value = PTR_ERR(kbuf);
kbuf = NULL;
goto free1; goto free1;
} }

View File

@ -828,7 +828,7 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
{ {
struct usba_ep *ep = to_usba_ep(_ep); struct usba_ep *ep = to_usba_ep(_ep);
struct usba_udc *udc = ep->udc; struct usba_udc *udc = ep->udc;
struct usba_request *req = to_usba_req(_req); struct usba_request *req;
unsigned long flags; unsigned long flags;
u32 status; u32 status;
@ -837,6 +837,16 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
spin_lock_irqsave(&udc->lock, flags); spin_lock_irqsave(&udc->lock, flags);
list_for_each_entry(req, &ep->queue, queue) {
if (&req->req == _req)
break;
}
if (&req->req != _req) {
spin_unlock_irqrestore(&udc->lock, flags);
return -EINVAL;
}
if (req->using_dma) { if (req->using_dma) {
/* /*
* If this request is currently being transferred, * If this request is currently being transferred,

View File

@ -59,6 +59,9 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node)
{ {
struct usb_phy *phy; struct usb_phy *phy;
if (!of_device_is_available(node))
return ERR_PTR(-ENODEV);
list_for_each_entry(phy, &phy_list, head) { list_for_each_entry(phy, &phy_list, head) {
if (node != phy->dev->of_node) if (node != phy->dev->of_node)
continue; continue;
@ -190,10 +193,13 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
spin_lock_irqsave(&phy_lock, flags); spin_lock_irqsave(&phy_lock, flags);
phy = __of_usb_find_phy(node); phy = __of_usb_find_phy(node);
if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { if (IS_ERR(phy)) {
if (!IS_ERR(phy)) devres_free(ptr);
phy = ERR_PTR(-ENODEV); goto err1;
}
if (!try_module_get(phy->dev->driver->owner)) {
phy = ERR_PTR(-ENODEV);
devres_free(ptr); devres_free(ptr);
goto err1; goto err1;
} }