diff options
-rw-r--r-- | drivers/usb/gadget/function/f_fs.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 6bdb57069044..71f68c48103e 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -315,7 +315,6 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf, | |||
315 | return ret; | 315 | return ret; |
316 | } | 316 | } |
317 | 317 | ||
318 | set_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags); | ||
319 | return len; | 318 | return len; |
320 | } | 319 | } |
321 | break; | 320 | break; |
@@ -1463,8 +1462,7 @@ static void ffs_data_clear(struct ffs_data *ffs) | |||
1463 | { | 1462 | { |
1464 | ENTER(); | 1463 | ENTER(); |
1465 | 1464 | ||
1466 | if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags)) | 1465 | ffs_closed(ffs); |
1467 | ffs_closed(ffs); | ||
1468 | 1466 | ||
1469 | BUG_ON(ffs->gadget); | 1467 | BUG_ON(ffs->gadget); |
1470 | 1468 | ||
@@ -3422,9 +3420,13 @@ static int ffs_ready(struct ffs_data *ffs) | |||
3422 | ffs_obj->desc_ready = true; | 3420 | ffs_obj->desc_ready = true; |
3423 | ffs_obj->ffs_data = ffs; | 3421 | ffs_obj->ffs_data = ffs; |
3424 | 3422 | ||
3425 | if (ffs_obj->ffs_ready_callback) | 3423 | if (ffs_obj->ffs_ready_callback) { |
3426 | ret = ffs_obj->ffs_ready_callback(ffs); | 3424 | ret = ffs_obj->ffs_ready_callback(ffs); |
3425 | if (ret) | ||
3426 | goto done; | ||
3427 | } | ||
3427 | 3428 | ||
3429 | set_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags); | ||
3428 | done: | 3430 | done: |
3429 | ffs_dev_unlock(); | 3431 | ffs_dev_unlock(); |
3430 | return ret; | 3432 | return ret; |
@@ -3443,7 +3445,8 @@ static void ffs_closed(struct ffs_data *ffs) | |||
3443 | 3445 | ||
3444 | ffs_obj->desc_ready = false; | 3446 | ffs_obj->desc_ready = false; |
3445 | 3447 | ||
3446 | if (ffs_obj->ffs_closed_callback) | 3448 | if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags) && |
3449 | ffs_obj->ffs_closed_callback) | ||
3447 | ffs_obj->ffs_closed_callback(ffs); | 3450 | ffs_obj->ffs_closed_callback(ffs); |
3448 | 3451 | ||
3449 | if (!ffs_obj->opts || ffs_obj->opts->no_configfs | 3452 | if (!ffs_obj->opts || ffs_obj->opts->no_configfs |