[PATCH] Input: Use true and false for bool variable

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, the rest

STALE1994d

2 messages, 2 authors, 2021-02-19 · open the first message on its own page

[PATCH] Input: Use true and false for bool variable

From: Jiapeng Chong <hidden>
Date: 2021-02-18 11:57:51

Fix the following coccicheck warnings:

./drivers/input/touchscreen/zinitix.c:250:8-9: WARNING: return of 0/1 in
function 'zinitix_init_touch' with return type bool.

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Chong <redacted>
---
 drivers/input/touchscreen/zinitix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c
index a3e3adb..acb1d53 100644
--- a/drivers/input/touchscreen/zinitix.c
+++ b/drivers/input/touchscreen/zinitix.c
@@ -247,7 +247,7 @@ static bool zinitix_init_touch(struct bt541_ts_data *bt541)
 		udelay(10);
 	}
 
-	return 0;
+	return false;
 }
 
 static int zinitix_init_regulators(struct bt541_ts_data *bt541)
-- 
1.8.3.1

Re: [PATCH] Input: Use true and false for bool variable

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2021-02-19 03:35:25

Hi,

On Thu, Feb 18, 2021 at 06:23:55PM +0800, Jiapeng Chong wrote:
quoted hunk
Fix the following coccicheck warnings:

./drivers/input/touchscreen/zinitix.c:250:8-9: WARNING: return of 0/1 in
function 'zinitix_init_touch' with return type bool.

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Chong <redacted>
---
 drivers/input/touchscreen/zinitix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c
index a3e3adb..acb1d53 100644
--- a/drivers/input/touchscreen/zinitix.c
+++ b/drivers/input/touchscreen/zinitix.c
@@ -247,7 +247,7 @@ static bool zinitix_init_touch(struct bt541_ts_data *bt541)
 		udelay(10);
 	}
 
-	return 0;
+	return false;
This is incorrect, as earlier we try to return error codes from this
function. It needs to be changed to return int, I'll take care of it.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help