Skip to content

Commit 9951bb2

Browse files
jigpuJiri Kosina
authored andcommitted
HID: hiddev: Return specific error codes on connect failure
The only caller of this function only cares about gross success/failure but we still might as well resolve the following smatch warning and fix the other error paths as well: hiddev.c:894 hiddev_connect() warn: returning -1 instead of -ENOMEM is sloppy Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 69aea9d commit 9951bb2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/hid/usbhid/hiddev.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,11 +887,11 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
887887
break;
888888

889889
if (i == hid->maxcollection)
890-
return -1;
890+
return -EINVAL;
891891
}
892892

893893
if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
894-
return -1;
894+
return -ENOMEM;
895895

896896
init_waitqueue_head(&hiddev->wait);
897897
INIT_LIST_HEAD(&hiddev->list);
@@ -905,7 +905,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
905905
hid_err(hid, "Not able to get a minor for this device\n");
906906
hid->hiddev = NULL;
907907
kfree(hiddev);
908-
return -1;
908+
return retval;
909909
}
910910

911911
/*

0 commit comments

Comments
 (0)