[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20131216001027.5e1e0a7e.akpm@linux-foundation.org>
Date: Mon, 16 Dec 2013 00:10:27 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Rui Xiang <rui.xiang@...wei.com>
Cc: <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] romfs: remove an redundant if condition in
romfs_readpage
On Tue, 26 Nov 2013 16:39:09 +0800 Rui Xiang <rui.xiang@...wei.com> wrote:
> Here ret always equals 0, so SetPageUptodate directly.
>
> ...
>
> --- a/fs/romfs/super.c
> +++ b/fs/romfs/super.c
> @@ -129,8 +129,7 @@ static int romfs_readpage(struct file *file, struct page *page)
>
> if (fillsize < PAGE_SIZE)
> memset(buf + fillsize, 0, PAGE_SIZE - fillsize);
> - if (ret == 0)
> - SetPageUptodate(page);
> + SetPageUptodate(page);
>
> flush_dcache_page(page);
> kunmap(page);
Nope, `ret' can be -EIO:
ret = 0;
if (offset < size) {
size -= offset;
fillsize = size > PAGE_SIZE ? PAGE_SIZE : size;
pos = ROMFS_I(inode)->i_dataoffset + offset;
ret = romfs_dev_read(inode->i_sb, pos, buf, fillsize);
if (ret < 0) {
SetPageError(page);
fillsize = 0;
-->> ret = -EIO;
}
}
if (fillsize < PAGE_SIZE)
memset(buf + fillsize, 0, PAGE_SIZE - fillsize);
if (ret == 0)
SetPageUptodate(page);
It was a bit rude to overwrite the romfs_dev_read() return code though.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists