[PATCH] drivers/pinctrl/bcm: Simplify bool comparison

Subsystems: broadcom iproc arm architecture, pin control subsystem, the rest

STALE2030d LANDED

Landed in mainline as e95d931a15bb on 2021-01-18.

4 messages, 3 authors, 2021-01-18 · open the first message on its own page

[PATCH] drivers/pinctrl/bcm: Simplify bool comparison

From: Jiapeng Zhong <hidden>
Date: 2021-01-15 10:10:11

Fix the follow coccicheck warnings:

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

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Zhong <redacted>
---
 drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
index 57044ab..0fe4a1f 100644
--- a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
+++ b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
@@ -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;
-- 
1.8.3.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] drivers/pinctrl/bcm: Simplify bool comparison

From: Ray Jui <hidden>
Date: 2021-01-15 18:25:53


On 1/15/2021 2:09 AM, Jiapeng Zhong wrote:
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 hunk
Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Zhong <redacted>
---
 drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
index 57044ab..0fe4a1f 100644
--- a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
+++ b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c
@@ -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
 			return 0;
 		else
 			return -EINVAL;

Re: [PATCH] drivers/pinctrl/bcm: Simplify bool comparison

From: Linus Walleij <hidden>
Date: 2021-01-18 15:35:22

On Fri, Jan 15, 2021 at 7:24 PM Ray Jui [off-list ref] wrote:
quoted
-             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
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] drivers/pinctrl/bcm: Simplify bool comparison

From: Linus Walleij <hidden>
Date: 2021-01-18 15:59:54

On Fri, Jan 15, 2021 at 11:09 AM Jiapeng Zhong
[off-list ref] wrote:
Fix the follow coccicheck warnings:

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

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Zhong <redacted>
Patch applied.

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help