From: Florian Schmaus Date: Thu, 26 Jul 2018 04:17:37 +0000 (+0800) Subject: bcache: do not assign in if condition register_bcache() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a56489d4b3c914eb30b724ff25debc2e59c7950e;p=linux.git bcache: do not assign in if condition register_bcache() Fixes an error condition reported by checkpatch.pl which is caused by assigning a variable in an if condition. Signed-off-by: Florian Schmaus Signed-off-by: Coly Li Signed-off-by: Jens Axboe --- diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index cea2a42ea2762..093b3789ce05b 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -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";