Skip to content

Commit

Permalink
usb: core: bail out if user gives an unknown RefId when using new_id
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wolfram Sang authored and Greg Kroah-Hartman committed Jan 13, 2014
1 parent 2fc82c2 commit 52a6966
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
const struct usb_device_id *id = id_table;

for (; id->match_flags; id++)
if (id->idVendor == refVendor && id->idProduct == refProduct) {
dynid->id.driver_info = id->driver_info;
if (id->idVendor == refVendor && id->idProduct == refProduct)
break;
}

if (id->match_flags)
dynid->id.driver_info = id->driver_info;
else
return -ENODEV;
}

spin_lock(&dynids->lock);
Expand Down

0 comments on commit 52a6966

Please sign in to comment.