aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-08-28 14:43:25 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-27 14:58:57 -0400
commit1b21d5e166e104f8914441ef52e2cd50ce65b479 (patch)
treee3139ee35d16be051d3dd01688bc29ec2afc7315 /drivers/usb
parent592fbbe4bc339399d363dd55f0391e0623400706 (diff)
USB: fix __must_check warnings in drivers/usb/core/
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/devio.c2
-rw-r--r--drivers/usb/core/driver.c10
-rw-r--r--drivers/usb/core/endpoint.c30
-rw-r--r--drivers/usb/core/sysfs.c55
-rw-r--r--drivers/usb/core/usb.c6
-rw-r--r--drivers/usb/core/usb.h6
6 files changed, 80 insertions, 29 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index fd345ad810f8..71bbd25a4ed0 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1359,7 +1359,7 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
1359 /* let kernel drivers try to (re)bind to the interface */ 1359 /* let kernel drivers try to (re)bind to the interface */
1360 case USBDEVFS_CONNECT: 1360 case USBDEVFS_CONNECT:
1361 usb_unlock_device(ps->dev); 1361 usb_unlock_device(ps->dev);
1362 bus_rescan_devices(intf->dev.bus); 1362 retval = bus_rescan_devices(intf->dev.bus);
1363 usb_lock_device(ps->dev); 1363 usb_lock_device(ps->dev);
1364 break; 1364 break;
1365 1365
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 0d063c8ca4b4..b10463244413 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -49,6 +49,7 @@ static ssize_t store_new_id(struct device_driver *driver,
49 u32 idVendor = 0; 49 u32 idVendor = 0;
50 u32 idProduct = 0; 50 u32 idProduct = 0;
51 int fields = 0; 51 int fields = 0;
52 int retval = 0;
52 53
53 fields = sscanf(buf, "%x %x", &idVendor, &idProduct); 54 fields = sscanf(buf, "%x %x", &idVendor, &idProduct);
54 if (fields < 2) 55 if (fields < 2)
@@ -68,10 +69,12 @@ static ssize_t store_new_id(struct device_driver *driver,
68 spin_unlock(&usb_drv->dynids.lock); 69 spin_unlock(&usb_drv->dynids.lock);
69 70
70 if (get_driver(driver)) { 71 if (get_driver(driver)) {
71 driver_attach(driver); 72 retval = driver_attach(driver);
72 put_driver(driver); 73 put_driver(driver);
73 } 74 }
74 75
76 if (retval)
77 return retval;
75 return count; 78 return count;
76} 79}
77static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); 80static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
@@ -291,6 +294,7 @@ int usb_driver_claim_interface(struct usb_driver *driver,
291{ 294{
292 struct device *dev = &iface->dev; 295 struct device *dev = &iface->dev;
293 struct usb_device *udev = interface_to_usbdev(iface); 296 struct usb_device *udev = interface_to_usbdev(iface);
297 int retval = 0;
294 298
295 if (dev->driver) 299 if (dev->driver)
296 return -EBUSY; 300 return -EBUSY;
@@ -308,9 +312,9 @@ int usb_driver_claim_interface(struct usb_driver *driver,
308 * the future device_add() bind it, bypassing probe() 312 * the future device_add() bind it, bypassing probe()
309 */ 313 */
310 if (device_is_registered(dev)) 314 if (device_is_registered(dev))
311 device_bind_driver(dev); 315 retval = device_bind_driver(dev);
312 316
313 return 0; 317 return retval;
314} 318}
315EXPORT_SYMBOL(usb_driver_claim_interface); 319EXPORT_SYMBOL(usb_driver_claim_interface);
316 320
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 247b5a4913a8..3ebb90149e93 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -207,9 +207,9 @@ static void ep_device_release(struct device *dev)
207 kfree(ep_dev); 207 kfree(ep_dev);
208} 208}
209 209
210void usb_create_ep_files(struct device *parent, 210int usb_create_ep_files(struct device *parent,
211 struct usb_host_endpoint *endpoint, 211 struct usb_host_endpoint *endpoint,
212 struct usb_device *udev) 212 struct usb_device *udev)
213{ 213{
214 char name[8]; 214 char name[8];
215 struct ep_device *ep_dev; 215 struct ep_device *ep_dev;
@@ -242,19 +242,33 @@ void usb_create_ep_files(struct device *parent,
242 retval = device_register(&ep_dev->dev); 242 retval = device_register(&ep_dev->dev);
243 if (retval) 243 if (retval)
244 goto error; 244 goto error;
245 sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); 245 retval = sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
246 if (retval)
247 goto error_group;
246 248
247 endpoint->ep_dev = ep_dev; 249 endpoint->ep_dev = ep_dev;
248 250
249 /* create the symlink to the old-style "ep_XX" directory */ 251 /* create the symlink to the old-style "ep_XX" directory */
250 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress); 252 sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress);
251 sysfs_create_link(&parent->kobj, &endpoint->ep_dev->dev.kobj, name); 253 retval = sysfs_create_link(&parent->kobj,
252 254 &endpoint->ep_dev->dev.kobj, name);
255 if (retval)
256 goto error_link;
253exit: 257exit:
254 return; 258 return retval;
259
260error_link:
261 sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp);
262
263error_group:
264 device_unregister(&ep_dev->dev);
265 endpoint->ep_dev = NULL;
266 destroy_endpoint_class();
267 return retval;
255error: 268error:
256 kfree(ep_dev); 269 kfree(ep_dev);
257 return; 270 destroy_endpoint_class();
271 return retval;
258} 272}
259 273
260void usb_remove_ep_files(struct usb_host_endpoint *endpoint) 274void usb_remove_ep_files(struct usb_host_endpoint *endpoint)
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index cd2286246f6a..55d8f575206d 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -210,19 +210,40 @@ static struct attribute_group dev_attr_grp = {
210 .attrs = dev_attrs, 210 .attrs = dev_attrs,
211}; 211};
212 212
213void usb_create_sysfs_dev_files (struct usb_device *udev) 213int usb_create_sysfs_dev_files(struct usb_device *udev)
214{ 214{
215 struct device *dev = &udev->dev; 215 struct device *dev = &udev->dev;
216 int retval;
216 217
217 sysfs_create_group(&dev->kobj, &dev_attr_grp); 218 retval = sysfs_create_group(&dev->kobj, &dev_attr_grp);
219 if (retval)
220 return retval;
218 221
219 if (udev->manufacturer) 222 if (udev->manufacturer) {
220 device_create_file (dev, &dev_attr_manufacturer); 223 retval = device_create_file (dev, &dev_attr_manufacturer);
221 if (udev->product) 224 if (retval)
222 device_create_file (dev, &dev_attr_product); 225 goto error;
223 if (udev->serial) 226 }
224 device_create_file (dev, &dev_attr_serial); 227 if (udev->product) {
225 usb_create_ep_files(dev, &udev->ep0, udev); 228 retval = device_create_file (dev, &dev_attr_product);
229 if (retval)
230 goto error;
231 }
232 if (udev->serial) {
233 retval = device_create_file (dev, &dev_attr_serial);
234 if (retval)
235 goto error;
236 }
237 retval = usb_create_ep_files(dev, &udev->ep0, udev);
238 if (retval)
239 goto error;
240 return 0;
241error:
242 usb_remove_ep_files(&udev->ep0);
243 device_remove_file(dev, &dev_attr_manufacturer);
244 device_remove_file(dev, &dev_attr_product);
245 device_remove_file(dev, &dev_attr_serial);
246 return retval;
226} 247}
227 248
228void usb_remove_sysfs_dev_files (struct usb_device *udev) 249void usb_remove_sysfs_dev_files (struct usb_device *udev)
@@ -339,18 +360,28 @@ static inline void usb_remove_intf_ep_files(struct usb_interface *intf)
339 usb_remove_ep_files(&iface_desc->endpoint[i]); 360 usb_remove_ep_files(&iface_desc->endpoint[i]);
340} 361}
341 362
342void usb_create_sysfs_intf_files (struct usb_interface *intf) 363int usb_create_sysfs_intf_files(struct usb_interface *intf)
343{ 364{
344 struct usb_device *udev = interface_to_usbdev(intf); 365 struct usb_device *udev = interface_to_usbdev(intf);
345 struct usb_host_interface *alt = intf->cur_altsetting; 366 struct usb_host_interface *alt = intf->cur_altsetting;
367 int retval;
346 368
347 sysfs_create_group(&intf->dev.kobj, &intf_attr_grp); 369 retval = sysfs_create_group(&intf->dev.kobj, &intf_attr_grp);
370 if (retval)
371 goto error;
348 372
349 if (alt->string == NULL) 373 if (alt->string == NULL)
350 alt->string = usb_cache_string(udev, alt->desc.iInterface); 374 alt->string = usb_cache_string(udev, alt->desc.iInterface);
351 if (alt->string) 375 if (alt->string)
352 device_create_file(&intf->dev, &dev_attr_interface); 376 retval = device_create_file(&intf->dev, &dev_attr_interface);
353 usb_create_intf_ep_files(intf, udev); 377 usb_create_intf_ep_files(intf, udev);
378 return 0;
379error:
380 if (alt->string)
381 device_remove_file(&intf->dev, &dev_attr_interface);
382 sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp);
383 usb_remove_intf_ep_files(intf);
384 return retval;
354} 385}
355 386
356void usb_remove_sysfs_intf_files (struct usb_interface *intf) 387void usb_remove_sysfs_intf_files (struct usb_interface *intf)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 6b029cdb8671..60ef4ef0101a 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -147,11 +147,13 @@ static int __find_interface(struct device * dev, void * data)
147struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) 147struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
148{ 148{
149 struct find_interface_arg argb; 149 struct find_interface_arg argb;
150 int retval;
150 151
151 argb.minor = minor; 152 argb.minor = minor;
152 argb.interface = NULL; 153 argb.interface = NULL;
153 driver_for_each_device(&drv->drvwrap.driver, NULL, &argb, 154 /* eat the error, it will be in argb.interface */
154 __find_interface); 155 retval = driver_for_each_device(&drv->drvwrap.driver, NULL, &argb,
156 __find_interface);
155 return argb.interface; 157 return argb.interface;
156} 158}
157 159
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index e8bc2e48913a..0c09ecced6e1 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -1,10 +1,10 @@
1/* Functions local to drivers/usb/core/ */ 1/* Functions local to drivers/usb/core/ */
2 2
3extern void usb_create_sysfs_dev_files (struct usb_device *dev); 3extern int usb_create_sysfs_dev_files (struct usb_device *dev);
4extern void usb_remove_sysfs_dev_files (struct usb_device *dev); 4extern void usb_remove_sysfs_dev_files (struct usb_device *dev);
5extern void usb_create_sysfs_intf_files (struct usb_interface *intf); 5extern int usb_create_sysfs_intf_files (struct usb_interface *intf);
6extern void usb_remove_sysfs_intf_files (struct usb_interface *intf); 6extern void usb_remove_sysfs_intf_files (struct usb_interface *intf);
7extern void usb_create_ep_files(struct device *parent, struct usb_host_endpoint *endpoint, 7extern int usb_create_ep_files(struct device *parent, struct usb_host_endpoint *endpoint,
8 struct usb_device *udev); 8 struct usb_device *udev);
9extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint); 9extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint);
10 10