aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/storage_common.c12
-rw-r--r--drivers/usb/gadget/u_uac1.c6
2 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index ae8b18869b8c..8d9bcd8207c8 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -656,9 +656,8 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
656 if (!(filp->f_mode & FMODE_WRITE)) 656 if (!(filp->f_mode & FMODE_WRITE))
657 ro = 1; 657 ro = 1;
658 658
659 if (filp->f_path.dentry) 659 inode = filp->f_path.dentry->d_inode;
660 inode = filp->f_path.dentry->d_inode; 660 if ((!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) {
661 if (!inode || (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) {
662 LINFO(curlun, "invalid file type: %s\n", filename); 661 LINFO(curlun, "invalid file type: %s\n", filename);
663 goto out; 662 goto out;
664 } 663 }
@@ -667,7 +666,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
667 * If we can't read the file, it's no good. 666 * If we can't read the file, it's no good.
668 * If we can't write the file, use it read-only. 667 * If we can't write the file, use it read-only.
669 */ 668 */
670 if (!filp->f_op || !(filp->f_op->read || filp->f_op->aio_read)) { 669 if (!(filp->f_op->read || filp->f_op->aio_read)) {
671 LINFO(curlun, "file not readable: %s\n", filename); 670 LINFO(curlun, "file not readable: %s\n", filename);
672 goto out; 671 goto out;
673 } 672 }
@@ -712,7 +711,6 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
712 if (fsg_lun_is_open(curlun)) 711 if (fsg_lun_is_open(curlun))
713 fsg_lun_close(curlun); 712 fsg_lun_close(curlun);
714 713
715 get_file(filp);
716 curlun->blksize = blksize; 714 curlun->blksize = blksize;
717 curlun->blkbits = blkbits; 715 curlun->blkbits = blkbits;
718 curlun->ro = ro; 716 curlun->ro = ro;
@@ -720,10 +718,10 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename)
720 curlun->file_length = size; 718 curlun->file_length = size;
721 curlun->num_sectors = num_sectors; 719 curlun->num_sectors = num_sectors;
722 LDBG(curlun, "open backing file: %s\n", filename); 720 LDBG(curlun, "open backing file: %s\n", filename);
723 rc = 0; 721 return 0;
724 722
725out: 723out:
726 filp_close(filp, current->files); 724 fput(filp);
727 return rc; 725 return rc;
728} 726}
729 727
diff --git a/drivers/usb/gadget/u_uac1.c b/drivers/usb/gadget/u_uac1.c
index af9898982059..e0c5e88e03ed 100644
--- a/drivers/usb/gadget/u_uac1.c
+++ b/drivers/usb/gadget/u_uac1.c
@@ -275,17 +275,17 @@ static int gaudio_close_snd_dev(struct gaudio *gau)
275 /* Close control device */ 275 /* Close control device */
276 snd = &gau->control; 276 snd = &gau->control;
277 if (snd->filp) 277 if (snd->filp)
278 filp_close(snd->filp, current->files); 278 filp_close(snd->filp, NULL);
279 279
280 /* Close PCM playback device and setup substream */ 280 /* Close PCM playback device and setup substream */
281 snd = &gau->playback; 281 snd = &gau->playback;
282 if (snd->filp) 282 if (snd->filp)
283 filp_close(snd->filp, current->files); 283 filp_close(snd->filp, NULL);
284 284
285 /* Close PCM capture device and setup substream */ 285 /* Close PCM capture device and setup substream */
286 snd = &gau->capture; 286 snd = &gau->capture;
287 if (snd->filp) 287 if (snd->filp)
288 filp_close(snd->filp, current->files); 288 filp_close(snd->filp, NULL);
289 289
290 return 0; 290 return 0;
291} 291}