diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2007-07-31 23:34:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:55:07 -0400 |
commit | f8a374648b58e5cfa14447eca866aed14a4fbfa8 (patch) | |
tree | 7b22cc7523f5c1fed5b3d8db4e72cedb40dc0e1b | |
parent | 72230abb21349cda54d6cce0d6fd325c023b958e (diff) |
usb: usb_generic_probe() obeys authorization
If called and the device is not authorized to be used, then we won't
choose a configuration (as they are not a concept that exists for an
unauthorized device). However, the device is added to the system.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/core/generic.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c index b2fc2b115256..20b095050a16 100644 --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c | |||
@@ -161,17 +161,20 @@ static int generic_probe(struct usb_device *udev) | |||
161 | /* Choose and set the configuration. This registers the interfaces | 161 | /* Choose and set the configuration. This registers the interfaces |
162 | * with the driver core and lets interface drivers bind to them. | 162 | * with the driver core and lets interface drivers bind to them. |
163 | */ | 163 | */ |
164 | c = choose_configuration(udev); | 164 | if (udev->authorized == 0) |
165 | if (c >= 0) { | 165 | dev_err(&udev->dev, "Device is not authorized for usage\n"); |
166 | err = usb_set_configuration(udev, c); | 166 | else { |
167 | if (err) { | 167 | c = choose_configuration(udev); |
168 | dev_err(&udev->dev, "can't set config #%d, error %d\n", | 168 | if (c >= 0) { |
169 | err = usb_set_configuration(udev, c); | ||
170 | if (err) { | ||
171 | dev_err(&udev->dev, "can't set config #%d, error %d\n", | ||
169 | c, err); | 172 | c, err); |
170 | /* This need not be fatal. The user can try to | 173 | /* This need not be fatal. The user can try to |
171 | * set other configurations. */ | 174 | * set other configurations. */ |
175 | } | ||
172 | } | 176 | } |
173 | } | 177 | } |
174 | |||
175 | /* USB device state == configured ... usable */ | 178 | /* USB device state == configured ... usable */ |
176 | usb_notify_add_device(udev); | 179 | usb_notify_add_device(udev); |
177 | 180 | ||