2021-05-08 02:48:57

by Zhen Lei

[permalink] [raw]
Subject: [PATCH 1/1] HID: pidff: fix error return code in hid_pidff_init()

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 224ee88fe395 ("Input: add force feedback driver for PID devices")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zhen Lei <[email protected]>
---
drivers/hid/usbhid/hid-pidff.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
index ea126c50acc3..3b4ee21cd811 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -1292,6 +1292,7 @@ int hid_pidff_init(struct hid_device *hid)

if (pidff->pool[PID_DEVICE_MANAGED_POOL].value &&
pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) {
+ error = -EPERM;
hid_notice(hid,
"device does not support device managed pool\n");
goto fail;
--
2.25.1



2021-05-26 10:43:50

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH 1/1] HID: pidff: fix error return code in hid_pidff_init()

On Sat, 8 May 2021, Zhen Lei wrote:

> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Fixes: 224ee88fe395 ("Input: add force feedback driver for PID devices")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Zhen Lei <[email protected]>
> ---
> drivers/hid/usbhid/hid-pidff.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c
> index ea126c50acc3..3b4ee21cd811 100644
> --- a/drivers/hid/usbhid/hid-pidff.c
> +++ b/drivers/hid/usbhid/hid-pidff.c
> @@ -1292,6 +1292,7 @@ int hid_pidff_init(struct hid_device *hid)
>
> if (pidff->pool[PID_DEVICE_MANAGED_POOL].value &&
> pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) {
> + error = -EPERM;
> hid_notice(hid,
> "device does not support device managed pool\n");
> goto fail;

Good catch, applied, thank you.

--
Jiri Kosina
SUSE Labs