diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-12 13:51:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-12 13:51:04 -0500 |
commit | 06087cb42dc1da096c37f51ea12ad676f00569a9 (patch) | |
tree | 22408ce4ca111f74fec50994b7d38b89f33dd738 /drivers/usb | |
parent | 9c9d82492b73991e8e13a6c0af06e44816c31438 (diff) | |
parent | 5fb694f96e7c19e66b1c55124b98812e32e3efa5 (diff) |
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
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/legacy/inode.c | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/atmel_usba_udc.c | 12 | ||||
-rw-r--r-- | drivers/usb/phy/phy.c | 12 |
3 files changed, 21 insertions, 4 deletions
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index 08048613eed6..db49ec4c748e 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c | |||
@@ -441,6 +441,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
441 | kbuf = memdup_user(buf, len); | 441 | kbuf = memdup_user(buf, len); |
442 | if (IS_ERR(kbuf)) { | 442 | if (IS_ERR(kbuf)) { |
443 | value = PTR_ERR(kbuf); | 443 | value = PTR_ERR(kbuf); |
444 | kbuf = NULL; | ||
444 | goto free1; | 445 | goto free1; |
445 | } | 446 | } |
446 | 447 | ||
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 93328ea7eb1b..9f93bed42052 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c | |||
@@ -828,7 +828,7 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
828 | { | 828 | { |
829 | struct usba_ep *ep = to_usba_ep(_ep); | 829 | struct usba_ep *ep = to_usba_ep(_ep); |
830 | struct usba_udc *udc = ep->udc; | 830 | struct usba_udc *udc = ep->udc; |
831 | struct usba_request *req = to_usba_req(_req); | 831 | struct usba_request *req; |
832 | unsigned long flags; | 832 | unsigned long flags; |
833 | u32 status; | 833 | u32 status; |
834 | 834 | ||
@@ -837,6 +837,16 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
837 | 837 | ||
838 | spin_lock_irqsave(&udc->lock, flags); | 838 | spin_lock_irqsave(&udc->lock, flags); |
839 | 839 | ||
840 | list_for_each_entry(req, &ep->queue, queue) { | ||
841 | if (&req->req == _req) | ||
842 | break; | ||
843 | } | ||
844 | |||
845 | if (&req->req != _req) { | ||
846 | spin_unlock_irqrestore(&udc->lock, flags); | ||
847 | return -EINVAL; | ||
848 | } | ||
849 | |||
840 | if (req->using_dma) { | 850 | if (req->using_dma) { |
841 | /* | 851 | /* |
842 | * If this request is currently being transferred, | 852 | * If this request is currently being transferred, |
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index 353c686498d4..ccfdfb24b240 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c | |||
@@ -59,6 +59,9 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node) | |||
59 | { | 59 | { |
60 | struct usb_phy *phy; | 60 | struct usb_phy *phy; |
61 | 61 | ||
62 | if (!of_device_is_available(node)) | ||
63 | return ERR_PTR(-ENODEV); | ||
64 | |||
62 | list_for_each_entry(phy, &phy_list, head) { | 65 | list_for_each_entry(phy, &phy_list, head) { |
63 | if (node != phy->dev->of_node) | 66 | if (node != phy->dev->of_node) |
64 | continue; | 67 | continue; |
@@ -190,10 +193,13 @@ struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev, | |||
190 | spin_lock_irqsave(&phy_lock, flags); | 193 | spin_lock_irqsave(&phy_lock, flags); |
191 | 194 | ||
192 | phy = __of_usb_find_phy(node); | 195 | phy = __of_usb_find_phy(node); |
193 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { | 196 | if (IS_ERR(phy)) { |
194 | if (!IS_ERR(phy)) | 197 | devres_free(ptr); |
195 | phy = ERR_PTR(-ENODEV); | 198 | goto err1; |
199 | } | ||
196 | 200 | ||
201 | if (!try_module_get(phy->dev->driver->owner)) { | ||
202 | phy = ERR_PTR(-ENODEV); | ||
197 | devres_free(ptr); | 203 | devres_free(ptr); |
198 | goto err1; | 204 | goto err1; |
199 | } | 205 | } |