# \[PATCH\] HID: usbhid: hid-pidff: Fix missing error code in hid\_pidff\_init()

- Subsystems: HID CORE LAYER, USB HID PID DRIVERS (USB WHEELBASES, JOYSTICKS, RUDDERS, ...), THE REST, USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
- Maintainers: Jiri Kosina, Benjamin Tissoires, Tomasz Pakuła, Oleg Makarenko, Linus Torvalds
- List: linux-input
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-input/2021/06/1398455/t

## \[PATCH\] HID: usbhid: hid-pidff: Fix missing error code in hid\_pidff\_init()

- From: Jiapeng Chong \<hidden\>
- Date: 2021-06-01 11:05:37 
- Message: https://ratatoskr.run/linux-input/2021/06/1398455.md

```text
The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'error'.

Eliminate the follow smatch warning:

drivers/hid/usbhid/hid-pidff.c:1297 hid_pidff_init() warn: missing error
code 'error'.

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Chong <redacted>
---
 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 ea126c5..731b49e 100644
--- a/drivers/hid/usbhid/hid-pidff.c
+++ b/drivers/hid/usbhid/hid-pidff.c
@@ -1294,6 +1294,7 @@ int hid_pidff_init(struct hid_device *hid)
 	    pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) {
 		hid_notice(hid,
 			   "device does not support device managed pool\n");
+		error = -EINVAL;
 		goto fail;
 	}
 
-- 
1.8.3.1

```

## Re: \[PATCH\] HID: usbhid: hid-pidff: Fix missing error code in hid\_pidff\_init()

- From: Jiri Kosina \<jikos@kernel.org\>
- Date: 2021-06-24 12:05:37 
- Message: https://ratatoskr.run/linux-input/2021/06/1424812.md

```text
On Tue, 1 Jun 2021, Jiapeng Chong wrote:

> The error code is missing in this code scenario, add the error code
> '-EINVAL' to the return value 'error'.
> 
> Eliminate the follow smatch warning:
> 
> drivers/hid/usbhid/hid-pidff.c:1297 hid_pidff_init() warn: missing error
> code 'error'.
> 
> Reported-by: Abaci Robot <redacted>
> Signed-off-by: Jiapeng Chong <redacted>

This has already been fixed in hid.git via 3dd653c077efd.

Thanks,

-- 
Jiri Kosina
SUSE Labs

```
