* [PATCH] HID: hiddev: Return specific error codes on connect failure
@ 2021-02-11 19:30 Jason Gerecke
2021-03-08 10:13 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Jason Gerecke @ 2021-02-11 19:30 UTC (permalink / raw)
To: linux-input; +Cc: Jiri Kosina, Benjamin Tissoires, Jason Gerecke
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>
---
drivers/hid/usbhid/hiddev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 45e0b1c75cb1..2fb2991dbe4c 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -887,11 +887,11 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
break;
if (i == hid->maxcollection)
- return -1;
+ return -EINVAL;
}
if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
- return -1;
+ return -ENOMEM;
init_waitqueue_head(&hiddev->wait);
INIT_LIST_HEAD(&hiddev->list);
@@ -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->hiddev = NULL;
kfree(hiddev);
- return -1;
+ return retval;
}
/*
--
2.30.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] HID: hiddev: Return specific error codes on connect failure
2021-02-11 19:30 [PATCH] HID: hiddev: Return specific error codes on connect failure Jason Gerecke
@ 2021-03-08 10:13 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2021-03-08 10:13 UTC (permalink / raw)
To: Jason Gerecke; +Cc: linux-input, Benjamin Tissoires, Jason Gerecke
On Thu, 11 Feb 2021, Jason Gerecke wrote:
> 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>
Applied, thank you Jason.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-08 10:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 19:30 [PATCH] HID: hiddev: Return specific error codes on connect failure Jason Gerecke
2021-03-08 10:13 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).