aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2014-01-12 04:07:50 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-12 19:09:35 -0500
commit52a6966c350624db89addc3e6a825f5e797a73e4 (patch)
treeb3f7f154831d0a369f34b3922016b26996da44f0 /drivers/usb/core
parent2fc82c2de604deabb86b0558be0a301bb2209a19 (diff)
usb: core: bail out if user gives an unknown RefId when using new_id
If users use the new RefId feature of new_id, give them an error message if they provided an unknown reference. That helps detecting typos. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/driver.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 9b29e5c94be7..620a0baf103e 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -74,10 +74,13 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
74 const struct usb_device_id *id = id_table; 74 const struct usb_device_id *id = id_table;
75 75
76 for (; id->match_flags; id++) 76 for (; id->match_flags; id++)
77 if (id->idVendor == refVendor && id->idProduct == refProduct) { 77 if (id->idVendor == refVendor && id->idProduct == refProduct)
78 dynid->id.driver_info = id->driver_info;
79 break; 78 break;
80 } 79
80 if (id->match_flags)
81 dynid->id.driver_info = id->driver_info;
82 else
83 return -ENODEV;
81 } 84 }
82 85
83 spin_lock(&dynids->lock); 86 spin_lock(&dynids->lock);