linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] hid: usbhid: Return -ENOMEM instead of -1 for memory allocation failure
@ 2012-11-21  6:20 Sachin Kamat
  2012-11-21  6:20 ` [PATCH 2/2] hid: hid-sensor-hub: Move NULL check to beginning Sachin Kamat
  2012-11-22 21:03 ` [PATCH 1/2] hid: usbhid: Return -ENOMEM instead of -1 for memory allocation failure Jiri Kosina
  0 siblings, 2 replies; 10+ messages in thread
From: Sachin Kamat @ 2012-11-21  6:20 UTC (permalink / raw)
  To: linux-input; +Cc: jkosina, jic23, sachin.kamat, patches

Silences the following smatch warning:
drivers/hid/usbhid/hiddev.c:897 hiddev_connect() warn:
returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/hid/usbhid/hiddev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 14599e2..50e2ab8 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -894,7 +894,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
 	}
 
 	if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
-		return -1;
+		return -ENOMEM;
 
 	init_waitqueue_head(&hiddev->wait);
 	INIT_LIST_HEAD(&hiddev->list);
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-11-27  9:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-21  6:20 [PATCH 1/2] hid: usbhid: Return -ENOMEM instead of -1 for memory allocation failure Sachin Kamat
2012-11-21  6:20 ` [PATCH 2/2] hid: hid-sensor-hub: Move NULL check to beginning Sachin Kamat
2012-11-21 12:42   ` Alan Cox
2012-11-21 17:11     ` Srinivas Pandruvada
2012-11-21 22:26       ` Jiri Kosina
2012-11-22 21:03 ` [PATCH 1/2] hid: usbhid: Return -ENOMEM instead of -1 for memory allocation failure Jiri Kosina
2012-11-26 18:05   ` Dmitry Torokhov
2012-11-26 22:09     ` Jiri Kosina
2012-11-27  4:42       ` Sachin Kamat
2012-11-27  9:55         ` 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).