Skip to contentSkip to conversation

drivers/pinctrl/bcm: Simplify bool comparison

PATCH In review Jiapeng Zhong 3 participants 4 messages Jan 15, 2021 – Jan 18, 2021

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

PATCH 1/1 drivers/pinctrl/bcm: Simplify bool comparison

Fix the follow coccicheck warnings:

./drivers/pinctrl/bcm/pinctrl-ns2-mux.c:856:29-38: WARNING:
Comparison to bool.

---
 drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/bcm/pinctrl-ns2-mux.c +1 -1
index 57044ab..0fe4a1f 100644
@@ -853,7 +853,7 @@ static int ns2_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
 	switch (param) {
 	case PIN_CONFIG_BIAS_DISABLE:
 		ns2_pin_get_pull(pctldev, pin, &pull_up, &pull_down);
-		if ((pull_up == false) && (pull_down == false))
+		if (!pull_up && !pull_down)
 			return 0;
 		else
 			return -EINVAL;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 5 lines · Jiapeng Zhong

Fix the follow coccicheck warnings:

./drivers/pinctrl/bcm/pinctrl-ns2-mux.c:856:29-38: WARNING:
Comparison to bool.

Sorry I must be missing something here. Why is there a warning while 'pull_up' and 'pull_down' are already of type 'bool' and compared to 'false'?

Quoted 11 lines
---
 drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/bcm/pinctrl-ns2-mux.c +0 -0
index 57044ab..0fe4a1f 100644

drivers/pinctrl/bcm/pinctrl-ns2-mux.c static int ns2_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin, · line 856

Quoted 5 lines
drivers/pinctrl/bcm/pinctrl-ns2-mux.c +1 -1
@@ -853,7 +853,7 @@ static int ns2_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
 	switch (param) {
 	case PIN_CONFIG_BIAS_DISABLE:
 		ns2_pin_get_pull(pctldev, pin, &pull_up, &pull_down);
-		if ((pull_up == false) && (pull_down == false))
+		if (!pull_up && !pull_down)

Looks fine as improvement, but I'm curious why there's a warning to start with.

Thanks,

Ray

Quoted 4 lines
drivers/pinctrl/bcm/pinctrl-ns2-mux.c +0 -0
 			return 0;
 		else
 			return -EINVAL;
#2 lore raw
Quoted 5 lines · Ray Jui

drivers/pinctrl/bcm/pinctrl-ns2-mux.c static int ns2_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin, · line 856

Quoted 2 lines
drivers/pinctrl/bcm/pinctrl-ns2-mux.c +1 -1
-             if ((pull_up == false) && (pull_down == false))
+             if (!pull_up && !pull_down)

Looks fine as improvement, but I'm curious why there's a warning to start with.

There is no semantic difference. This is a purely syntactic warning.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel