aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/file_storage.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index 8d7f1e84cd7b..d472c9c29904 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -3873,21 +3873,26 @@ static int __init fsg_bind(struct usb_gadget *gadget)
3873 for (i = 0; i < fsg->nluns; ++i) { 3873 for (i = 0; i < fsg->nluns; ++i) {
3874 curlun = &fsg->luns[i]; 3874 curlun = &fsg->luns[i];
3875 curlun->ro = mod_data.ro[i]; 3875 curlun->ro = mod_data.ro[i];
3876 curlun->dev.release = lun_release;
3876 curlun->dev.parent = &gadget->dev; 3877 curlun->dev.parent = &gadget->dev;
3877 curlun->dev.driver = &fsg_driver.driver; 3878 curlun->dev.driver = &fsg_driver.driver;
3878 dev_set_drvdata(&curlun->dev, fsg); 3879 dev_set_drvdata(&curlun->dev, fsg);
3879 snprintf(curlun->dev.bus_id, BUS_ID_SIZE, 3880 snprintf(curlun->dev.bus_id, BUS_ID_SIZE,
3880 "%s-lun%d", gadget->dev.bus_id, i); 3881 "%s-lun%d", gadget->dev.bus_id, i);
3881 3882
3882 if ((rc = device_register(&curlun->dev)) != 0) 3883 if ((rc = device_register(&curlun->dev)) != 0) {
3883 INFO(fsg, "failed to register LUN%d: %d\n", i, rc); 3884 INFO(fsg, "failed to register LUN%d: %d\n", i, rc);
3884 else { 3885 goto out;
3885 curlun->registered = 1; 3886 }
3886 curlun->dev.release = lun_release; 3887 if ((rc = device_create_file(&curlun->dev,
3887 device_create_file(&curlun->dev, &dev_attr_ro); 3888 &dev_attr_ro)) != 0 ||
3888 device_create_file(&curlun->dev, &dev_attr_file); 3889 (rc = device_create_file(&curlun->dev,
3889 kref_get(&fsg->ref); 3890 &dev_attr_file)) != 0) {
3891 device_unregister(&curlun->dev);
3892 goto out;
3890 } 3893 }
3894 curlun->registered = 1;
3895 kref_get(&fsg->ref);
3891 3896
3892 if (mod_data.file[i] && *mod_data.file[i]) { 3897 if (mod_data.file[i] && *mod_data.file[i]) {
3893 if ((rc = open_backing_file(curlun, 3898 if ((rc = open_backing_file(curlun,