* [PATCH] ubifs: return err value than 0
@ 2015-03-23 5:11 Sanidhya Kashyap
0 siblings, 0 replies; only message in thread
From: Sanidhya Kashyap @ 2015-03-23 5:11 UTC (permalink / raw)
To: dedekind1, adrian.hunter, linux-mtd, linux-kernel
Cc: blee, taesoo, changwoo, sanidhya, Sanidhya Kashyap
Currently, ubifs_readpage only returns 0 even if ubifs_bulk_read()
fails. Like the other file systems, the error value should be
propagated further instead of 0.
Another check that is missing is ENOMEM for kmalloc.
Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
---
fs/ubifs/file.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index e627c0a..28fe892 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -863,8 +863,10 @@ static int ubifs_bulk_read(struct page *page)
bu = &c->bu;
else {
bu = kmalloc(sizeof(struct bu_info), GFP_NOFS | __GFP_NOWARN);
- if (!bu)
+ if (!bu) {
+ err = -ENOMEM;
goto out_unlock;
+ }
bu->buf = NULL;
allocated = 1;
@@ -887,11 +889,14 @@ out_unlock:
static int ubifs_readpage(struct file *file, struct page *page)
{
- if (ubifs_bulk_read(page))
- return 0;
+ int err = 0;
+
+ err = ubifs_bulk_read(page);
+ if (err)
+ return err;
do_readpage(page);
unlock_page(page);
- return 0;
+ return err;
}
static int do_writepage(struct page *page, int len)
--
2.1.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-03-23 5:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-23 5:11 [PATCH] ubifs: return err value than 0 Sanidhya Kashyap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).