Skip to content

Commit b832da5

Browse files
JuliaLawallJiri Kosina
authored andcommitted
HID: logitech-hidpp: fix error return code
Return a negative error code on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier ret; expression e1,e2; @@ ( if (\(ret < 0\|ret != 0\)) { ... return ret; } | ret = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <[email protected]> Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 9188dba commit b832da5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/hid/hid-logitech-hidpp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,7 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
12201220
connected = hidpp_is_connected(hidpp);
12211221
if (id->group != HID_GROUP_LOGITECH_DJ_DEVICE) {
12221222
if (!connected) {
1223+
ret = -ENODEV;
12231224
hid_err(hdev, "Device not connected");
12241225
hid_device_io_stop(hdev);
12251226
goto hid_parse_fail;

0 commit comments

Comments
 (0)