[PATCH 1/4] char/snsc: Adjust one function call together with a variable assignment
From: SF Markus Elfring
Date: Mon Oct 16 2017 - 11:04:26 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 16 Oct 2017 16:15:21 +0200
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix the affected source code place.
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/char/snsc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c
index 6aa32679fd58..f551a625686a 100644
--- a/drivers/char/snsc.c
+++ b/drivers/char/snsc.c
@@ -419,7 +419,8 @@ scdrv_init(void)
/* initialize sysctl device data fields */
scd->scd_nasid = cnodeid_to_nasid(cnode);
- if (!(salbuf = kmalloc(SCDRV_BUFSZ, GFP_KERNEL))) {
+ salbuf = kmalloc(SCDRV_BUFSZ, GFP_KERNEL);
+ if (!salbuf) {
printk("%s: failed to allocate driver buffer"
"(%s%s)\n", __func__,
SYSCTL_BASENAME, devname);
--
2.14.2