linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFS: fix the return value of nfs4_blkdev_get()
@ 2012-09-25  5:43 Wei Yongjun
  2012-09-25  7:11 ` Peng, Tao
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2012-09-25  5:43 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: yongjun_wei, linux-nfs

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, the function nfs4_blkdev_get() return NULL pointer.
But the user nfs4_blk_decode_device() check the return value by using
IS_ERR() and get error code from the return value. So we should better
change the return value of nfs4_blkdev_get() to return ERR_PTR().

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 fs/nfs/blocklayout/blocklayoutdev.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/blocklayout/blocklayoutdev.c b/fs/nfs/blocklayout/blocklayoutdev.c
index c965542..8c51518 100644
--- a/fs/nfs/blocklayout/blocklayoutdev.c
+++ b/fs/nfs/blocklayout/blocklayoutdev.c
@@ -61,12 +61,9 @@ struct block_device *nfs4_blkdev_get(dev_t dev)
 	dprintk("%s enter\n", __func__);
 	bd = blkdev_get_by_dev(dev, FMODE_READ, NULL);
 	if (IS_ERR(bd))
-		goto fail;
+		dprintk("%s failed to open device : %ld\n",
+				__func__, PTR_ERR(bd));
 	return bd;
-fail:
-	dprintk("%s failed to open device : %ld\n",
-			__func__, PTR_ERR(bd));
-	return NULL;
 }
 
 /*



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-25 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25  5:43 [PATCH] NFS: fix the return value of nfs4_blkdev_get() Wei Yongjun
2012-09-25  7:11 ` Peng, Tao
2012-09-25  7:59   ` yongjun_wei
2012-09-25 12:46   ` Jim Rees

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).