diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/nandsim.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 42e8a770e631..4f0d83648e5a 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
@@ -575,12 +575,12 @@ static int alloc_device(struct nandsim *ns) | |||
575 | cfile = filp_open(cache_file, O_CREAT | O_RDWR | O_LARGEFILE, 0600); | 575 | cfile = filp_open(cache_file, O_CREAT | O_RDWR | O_LARGEFILE, 0600); |
576 | if (IS_ERR(cfile)) | 576 | if (IS_ERR(cfile)) |
577 | return PTR_ERR(cfile); | 577 | return PTR_ERR(cfile); |
578 | if (!cfile->f_op->read && !cfile->f_op->aio_read) { | 578 | if (!(cfile->f_mode & FMODE_CAN_READ)) { |
579 | NS_ERR("alloc_device: cache file not readable\n"); | 579 | NS_ERR("alloc_device: cache file not readable\n"); |
580 | err = -EINVAL; | 580 | err = -EINVAL; |
581 | goto err_close; | 581 | goto err_close; |
582 | } | 582 | } |
583 | if (!cfile->f_op->write && !cfile->f_op->aio_write) { | 583 | if (!(cfile->f_mode & FMODE_CAN_WRITE)) { |
584 | NS_ERR("alloc_device: cache file not writeable\n"); | 584 | NS_ERR("alloc_device: cache file not writeable\n"); |
585 | err = -EINVAL; | 585 | err = -EINVAL; |
586 | goto err_close; | 586 | goto err_close; |