# \[PATCH\] Input:keyboard:samsung-keypad - Fix for correct return type

- Subsystems: INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS, THE REST
- Maintainers: Dmitry Torokhov, Linus Torvalds
- List: linux-input
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-input/2015/05/4501656/t

## \[PATCH\] Input:keyboard:samsung-keypad - Fix for correct return type

- From: Shailendra Verma \<hidden\>
- Date: 2015-05-25 17:00:24 
- Message: https://ratatoskr.run/linux-input/2015/05/4501656.md

```text
The return type of the function samsung_keypad_report() is bool but we are
returning the unsigned int value.So changing the unsigned int to bool type
and initializing with false.

Signed-off-by: Shailendra Verma <redacted>
---
 drivers/input/keyboard/samsung-keypad.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index 6b9fdf6..44b1ba9 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -112,7 +112,7 @@ static bool samsung_keypad_report(struct samsung_keypad *keypad,
 	struct input_dev *input_dev = keypad->input_dev;
 	unsigned int changed;
 	unsigned int pressed;
-	unsigned int key_down = 0;
+	bool key_down = false;
 	unsigned int val;
 	unsigned int col, row;
 
-- 
1.7.9.5

```

## Re: \[PATCH\] Input:keyboard:samsung-keypad - Fix for correct return type

- From: Dmitry Torokhov \<dmitry.torokhov@gmail.com\>
- Date: 2015-05-26 20:41:40 
- Message: https://ratatoskr.run/linux-input/2015/05/4502596.md

```text
On Mon, May 25, 2015 at 10:30:04PM +0530, Shailendra Verma wrote:
> The return type of the function samsung_keypad_report() is bool but we are
> returning the unsigned int value.So changing the unsigned int to bool type
> and initializing with false.
> 
> Signed-off-by: Shailendra Verma <redacted>
> ---
>  drivers/input/keyboard/samsung-keypad.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
> index 6b9fdf6..44b1ba9 100644
> --- a/drivers/input/keyboard/samsung-keypad.c
> +++ b/drivers/input/keyboard/samsung-keypad.c
> @@ -112,7 +112,7 @@ static bool samsung_keypad_report(struct samsung_keypad *keypad,
>  	struct input_dev *input_dev = keypad->input_dev;
>  	unsigned int changed;
>  	unsigned int pressed;
> -	unsigned int key_down = 0;
> +	bool key_down = false;

No, this causes conversion bool->unsigned int->bool on every iteration
of the loop.

Thanks.

-- 
Dmitry
```
