bcache: do not assign in if condition register_bcache()
authorFlorian Schmaus <flo@geekplace.eu>
Thu, 26 Jul 2018 04:17:37 +0000 (12:17 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 27 Jul 2018 15:15:46 +0000 (09:15 -0600)
Fixes an error condition reported by checkpatch.pl which is caused by
assigning a variable in an if condition.

Signed-off-by: Florian Schmaus <flo@geekplace.eu>
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/super.c

index cea2a42..093b378 100644 (file)
@@ -2165,8 +2165,12 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
        if (!try_module_get(THIS_MODULE))
                return -EBUSY;
 
-       if (!(path = kstrndup(buffer, size, GFP_KERNEL)) ||
-           !(sb = kmalloc(sizeof(struct cache_sb), GFP_KERNEL)))
+       path = kstrndup(buffer, size, GFP_KERNEL);
+       if (!path)
+               goto err;
+
+       sb = kmalloc(sizeof(struct cache_sb), GFP_KERNEL);
+       if (!sb)
                goto err;
 
        err = "failed to open device";