Commit 9951bb25 authored by Jason Gerecke's avatar Jason Gerecke Committed by Jiri Kosina

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: default avatarJason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 69aea9d2
...@@ -887,11 +887,11 @@ int hiddev_connect(struct hid_device *hid, unsigned int force) ...@@ -887,11 +887,11 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
break; break;
if (i == hid->maxcollection) if (i == hid->maxcollection)
return -1; return -EINVAL;
} }
if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
return -1; return -ENOMEM;
init_waitqueue_head(&hiddev->wait); init_waitqueue_head(&hiddev->wait);
INIT_LIST_HEAD(&hiddev->list); INIT_LIST_HEAD(&hiddev->list);
...@@ -905,7 +905,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int force) ...@@ -905,7 +905,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
hid_err(hid, "Not able to get a minor for this device\n"); hid_err(hid, "Not able to get a minor for this device\n");
hid->hiddev = NULL; hid->hiddev = NULL;
kfree(hiddev); kfree(hiddev);
return -1; return retval;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment