diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2010-11-27 19:49:18 +0100 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-11-27 19:49:18 +0100 |
commit | f30195c50245d8ace628e1978b1daa8df86e7224 (patch) | |
tree | edf4f91c4356c41d50fb07f15cebd1e6442538ad /drivers/usb | |
parent | block: Rename "block_remap" tracepoint to "block_bio_remap" to clarify the ev... (diff) | |
parent | block: clean up blkdev_get() wrappers and their users (diff) | |
download | linux-f30195c50245d8ace628e1978b1daa8df86e7224.tar.xz linux-f30195c50245d8ace628e1978b1daa8df86e7224.zip |
Merge branch 'cleanup-bd_claim' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into for-2.6.38/core
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/storage_common.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c index 3b513bafaf2a..b015561fd602 100644 --- a/drivers/usb/gadget/storage_common.c +++ b/drivers/usb/gadget/storage_common.c @@ -543,7 +543,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename) ro = curlun->initially_ro; if (!ro) { filp = filp_open(filename, O_RDWR | O_LARGEFILE, 0); - if (-EROFS == PTR_ERR(filp)) + if (PTR_ERR(filp) == -EROFS || PTR_ERR(filp) == -EACCES) ro = 1; } if (ro) @@ -558,10 +558,7 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename) if (filp->f_path.dentry) inode = filp->f_path.dentry->d_inode; - if (inode && S_ISBLK(inode->i_mode)) { - if (bdev_read_only(inode->i_bdev)) - ro = 1; - } else if (!inode || !S_ISREG(inode->i_mode)) { + if (!inode || (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))) { LINFO(curlun, "invalid file type: %s\n", filename); goto out; } |