From: Christoph Hellwig Date: Wed, 5 Nov 2008 13:54:41 +0000 (+0100) Subject: [PATCH] clean up blkdev_get a little bit X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ebbefc011e56bd85b4745d01e5b8d7d05d95ed5d;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git [PATCH] clean up blkdev_get a little bit The way the bd_claim for the FMODE_EXCL case is implemented is rather confusing. Clean it up to the most logical style. Signed-off-by: Christoph Hellwig Signed-off-by: Al Viro --- diff --git a/fs/block_dev.c b/fs/block_dev.c index db831efbdbbd..7c727523bc54 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1135,12 +1135,15 @@ static int blkdev_open(struct inode * inode, struct file * filp) if (res) return res; - if (!(filp->f_mode & FMODE_EXCL)) - return 0; + if (filp->f_mode & FMODE_EXCL) { + res = bd_claim(bdev, filp); + if (res) + goto out_blkdev_put; + } - if (!(res = bd_claim(bdev, filp))) - return 0; + return 0; + out_blkdev_put: blkdev_put(bdev, filp->f_mode); return res; }