mtd: block2mtd: page_read() never returns NULL

Submitted by Ryosuke Saito on April 23, 2012, 10:47 a.m.

Details

Message ID 1335178037.3060.7.camel@HDL00099
State Accepted
Commit 39a5d0b93c244f40ee2e1502e4870685b7dcc1fa
Headers show

Commit Message

Ryosuke Saito April 23, 2012, 10:47 a.m.
page_read() never returns NULL, so we can remove the NULL check here.

Signed-off-by: Ryosuke Saito <raitosyo@gmail.com>
---
 drivers/mtd/devices/block2mtd.c |    6 ------
 1 file changed, 6 deletions(-)

Comments

Artem Bityutskiy April 28, 2012, 11:58 a.m.
On Mon, 2012-04-23 at 19:47 +0900, Ryosuke Saito wrote:
> page_read() never returns NULL, so we can remove the NULL check here.
> 
> Signed-off-by: Ryosuke Saito <raitosyo@gmail.com>

Pushed to l2-mtd.git, thanks!

Patch hide | download patch | download mbox

diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index a4a80b7..300aeb8 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -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);