Skip to contentSkip to conversation

Staging: fbtft: Use !x instead of x == NULL.

PATCH In review Sandhya Bankar 2 participants 3 messages Sep 16, 2016 – Sep 17, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: fbtft: Use !x instead of x == NULL.

Use !x instead of x == NULL.
This issue was found by checkpatch.

---
 drivers/staging/fbtft/fbtft_device.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/fbtft/fbtft_device.c +3 -3
index 924abd3..e921183 100755
@@ -1401,7 +1401,7 @@ static int __init fbtft_device_init(void)
 	long val;
 	int ret = 0;
 
-	if (name == NULL) {
+	if (!name) {
 #ifdef MODULE
 		pr_err("missing module parameter: 'name'\n");
 		return -EINVAL;
@@ -1418,14 +1418,14 @@ static int __init fbtft_device_init(void)
 
 	/* parse module parameter: gpios */
 	while ((p_gpio = strsep(&gpios, ","))) {
-		if (strchr(p_gpio, ':') == NULL) {
+		if (!strchr(p_gpio, ':')) {
 			pr_err("error: missing ':' in gpios parameter: %s\n",
 			       p_gpio);
 			return -EINVAL;
 		}
 		p_num = p_gpio;
 		p_name = strsep(&p_num, ":");
-		if (p_name == NULL || p_num == NULL) {
+		if (!p_name || !p_num) {
 			pr_err("something bad happened parsing gpios parameter: %s\n",
 			       p_gpio);
 			return -EINVAL;
Signature · 1 line
1.7.1
maintainer
#1 lore raw

drivers/staging/fbtft/fbtft_device.c

Quoted 10 lines · Sandhya Bankar

Use !x instead of x == NULL.
This issue was found by checkpatch.

---
 drivers/staging/fbtft/fbtft_device.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/fbtft/fbtft_device.c +0 -0
index 924abd3..e921183 100755

How did this file get to be 0755 permissions? What are you using to edit this? It is a virtual machine somehow?

Please be more careful in the future...

thanks,

greg k-h

maintainer
#2 lore raw
In reply to Sandhya Bankar

drivers/staging/fbtft/fbtft_device.c

Quoted 10 lines · Sandhya Bankar

Use !x instead of x == NULL.
This issue was found by checkpatch.

---
 drivers/staging/fbtft/fbtft_device.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/fbtft/fbtft_device.c +0 -0
index 924abd3..e921183 100755

Oh, please fix up and resend.

thanks,

greg k-h