mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
USB: cdc-wdm: fix wdm_find_device* return value
commit 6a44886899
upstream.
A logic error made the wdm_find_device* functions
return a bogus pointer into static data instead of
the intended NULL no matching device was found.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7acab78d0f
commit
5527f13416
1 changed files with 8 additions and 4 deletions
|
@ -134,12 +134,14 @@ static struct usb_driver wdm_driver;
|
|||
/* return intfdata if we own the interface, else look up intf in the list */
|
||||
static struct wdm_device *wdm_find_device(struct usb_interface *intf)
|
||||
{
|
||||
struct wdm_device *desc = NULL;
|
||||
struct wdm_device *desc;
|
||||
|
||||
spin_lock(&wdm_device_list_lock);
|
||||
list_for_each_entry(desc, &wdm_device_list, device_list)
|
||||
if (desc->intf == intf)
|
||||
break;
|
||||
goto found;
|
||||
desc = NULL;
|
||||
found:
|
||||
spin_unlock(&wdm_device_list_lock);
|
||||
|
||||
return desc;
|
||||
|
@ -147,12 +149,14 @@ static struct wdm_device *wdm_find_device(struct usb_interface *intf)
|
|||
|
||||
static struct wdm_device *wdm_find_device_by_minor(int minor)
|
||||
{
|
||||
struct wdm_device *desc = NULL;
|
||||
struct wdm_device *desc;
|
||||
|
||||
spin_lock(&wdm_device_list_lock);
|
||||
list_for_each_entry(desc, &wdm_device_list, device_list)
|
||||
if (desc->intf->minor == minor)
|
||||
break;
|
||||
goto found;
|
||||
desc = NULL;
|
||||
found:
|
||||
spin_unlock(&wdm_device_list_lock);
|
||||
|
||||
return desc;
|
||||
|
|
Loading…
Reference in a new issue