Re: [PATCH 3/3] btrfs: misc cleanup btrfs_scan_one_device()

2018-01-05 Thread David Sterba
On Fri, Dec 15, 2017 at 03:40:16PM +0800, Anand Jain wrote:
> Assign ret = -EINVAL where actually its required.
> Remove { } around single line if else code.
> 
> Signed-off-by: Anand Jain 

Added to next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] btrfs: misc cleanup btrfs_scan_one_device()

2017-12-14 Thread Anand Jain
Assign ret = -EINVAL where actually its required.
Remove { } around single line if else code.

Signed-off-by: Anand Jain 
---
 fs/btrfs/volumes.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index a7eb9b42cd92..ba06a4ccd5a6 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1173,7 +1173,7 @@ int btrfs_scan_one_device(const char *path, fmode_t 
flags, void *holder,
struct btrfs_super_block *disk_super;
struct block_device *bdev;
struct page *page;
-   int ret = -EINVAL;
+   int ret;
u64 devid;
u64 transid;
u64 total_devices;
@@ -1192,8 +1192,10 @@ int btrfs_scan_one_device(const char *path, fmode_t 
flags, void *holder,
if (IS_ERR(bdev))
return PTR_ERR(bdev);
 
-   if (btrfs_read_disk_super(bdev, bytenr, &page, &disk_super))
+   if (btrfs_read_disk_super(bdev, bytenr, &page, &disk_super)) {
+   ret = -EINVAL;
goto error_bdev_put;
+   }
 
devid = btrfs_stack_device_id(&disk_super->dev_item);
transid = btrfs_super_generation(disk_super);
@@ -1206,11 +1208,10 @@ int btrfs_scan_one_device(const char *path, fmode_t 
flags, void *holder,
mutex_unlock(&uuid_mutex);
 
if (ret > 0) {
-   if (disk_super->label[0]) {
+   if (disk_super->label[0])
pr_info("BTRFS: device label %s ", disk_super->label);
-   } else {
+   else
pr_info("BTRFS: device fsid %pU ", disk_super->fsid);
-   }
 
pr_cont("devid %llu transid %llu %s\n", devid, transid, path);
ret = 0;
-- 
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html