Commit 76ce37f0 authored by Markus Elfring's avatar Markus Elfring Committed by Linus Walleij

pinctrl: Adjust five checks for null pointers

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent de2eae26
...@@ -319,7 +319,7 @@ static int pinconf_pins_show(struct seq_file *s, void *what) ...@@ -319,7 +319,7 @@ static int pinconf_pins_show(struct seq_file *s, void *what)
pin = pctldev->desc->pins[i].number; pin = pctldev->desc->pins[i].number;
desc = pin_desc_get(pctldev, pin); desc = pin_desc_get(pctldev, pin);
/* Skip if we cannot search the pin */ /* Skip if we cannot search the pin */
if (desc == NULL) if (!desc)
continue; continue;
seq_printf(s, "pin %d (%s): ", pin, desc->name); seq_printf(s, "pin %d (%s): ", pin, desc->name);
...@@ -524,7 +524,7 @@ static ssize_t pinconf_dbg_config_write(struct file *file, ...@@ -524,7 +524,7 @@ static ssize_t pinconf_dbg_config_write(struct file *file,
/* get arg 'device_name' */ /* get arg 'device_name' */
token = strsep(&b, " "); token = strsep(&b, " ");
if (token == NULL) if (!token)
return -EINVAL; return -EINVAL;
if (strlen(token) >= MAX_NAME_LEN) if (strlen(token) >= MAX_NAME_LEN)
return -EINVAL; return -EINVAL;
...@@ -532,7 +532,7 @@ static ssize_t pinconf_dbg_config_write(struct file *file, ...@@ -532,7 +532,7 @@ static ssize_t pinconf_dbg_config_write(struct file *file,
/* get arg 'state_name' */ /* get arg 'state_name' */
token = strsep(&b, " "); token = strsep(&b, " ");
if (token == NULL) if (!token)
return -EINVAL; return -EINVAL;
if (strlen(token) >= MAX_NAME_LEN) if (strlen(token) >= MAX_NAME_LEN)
return -EINVAL; return -EINVAL;
...@@ -540,7 +540,7 @@ static ssize_t pinconf_dbg_config_write(struct file *file, ...@@ -540,7 +540,7 @@ static ssize_t pinconf_dbg_config_write(struct file *file,
/* get arg 'pin_name' */ /* get arg 'pin_name' */
token = strsep(&b, " "); token = strsep(&b, " ");
if (token == NULL) if (!token)
return -EINVAL; return -EINVAL;
if (strlen(token) >= MAX_NAME_LEN) if (strlen(token) >= MAX_NAME_LEN)
return -EINVAL; return -EINVAL;
...@@ -548,7 +548,7 @@ static ssize_t pinconf_dbg_config_write(struct file *file, ...@@ -548,7 +548,7 @@ static ssize_t pinconf_dbg_config_write(struct file *file,
/* get new_value of config' */ /* get new_value of config' */
token = strsep(&b, " "); token = strsep(&b, " ");
if (token == NULL) if (!token)
return -EINVAL; return -EINVAL;
if (strlen(token) >= MAX_NAME_LEN) if (strlen(token) >= MAX_NAME_LEN)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment