mtd: block2mtd: page_read() never returns NULL
authorRyosuke Saito <raitosyo@gmail.com>
Mon, 23 Apr 2012 10:47:17 +0000 (19:47 +0900)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 14 May 2012 03:56:52 +0000 (22:56 -0500)
page_read() never returns NULL, so we can remove the NULL check here.

Signed-off-by: Ryosuke Saito <raitosyo@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/devices/block2mtd.c

index a4a80b742e65e99d602161002dd4296614e8593d..300aeb837ee3ae3e8f9c969092989456a9199e09 100644 (file)
@@ -52,8 +52,6 @@ static int _block2mtd_erase(struct block2mtd_dev *dev, loff_t to, size_t len)
 
        while (pages) {
                page = page_read(mapping, index);
-               if (!page)
-                       return -ENOMEM;
                if (IS_ERR(page))
                        return PTR_ERR(page);
 
@@ -112,8 +110,6 @@ static int block2mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
                len = len - cpylen;
 
                page = page_read(dev->blkdev->bd_inode->i_mapping, index);
-               if (!page)
-                       return -ENOMEM;
                if (IS_ERR(page))
                        return PTR_ERR(page);
 
@@ -148,8 +144,6 @@ static int _block2mtd_write(struct block2mtd_dev *dev, const u_char *buf,
                len = len - cpylen;
 
                page = page_read(mapping, index);
-               if (!page)
-                       return -ENOMEM;
                if (IS_ERR(page))
                        return PTR_ERR(page);