* [patch] HID: roccat: silence an uninitialized variable warning
@ 2016-04-02 4:44 Dan Carpenter
2016-04-04 7:50 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-04-02 4:44 UTC (permalink / raw)
To: Stefan Achatz
Cc: Jiri Kosina, Benjamin Tissoires, linux-input, kernel-janitors
My static checker complains because we use "dev_id" before we check for
errors so it could be uninitialized. Fix this by moving the error
handling forward a couple lines.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c
index 65c4ccfc..76d06cf 100644
--- a/drivers/hid/hid-roccat.c
+++ b/drivers/hid/hid-roccat.c
@@ -421,14 +421,13 @@ static int __init roccat_init(void)
retval = alloc_chrdev_region(&dev_id, ROCCAT_FIRST_MINOR,
ROCCAT_MAX_DEVICES, "roccat");
-
- roccat_major = MAJOR(dev_id);
-
if (retval < 0) {
pr_warn("can't get major number\n");
goto error;
}
+ roccat_major = MAJOR(dev_id);
+
cdev_init(&roccat_cdev, &roccat_ops);
retval = cdev_add(&roccat_cdev, dev_id, ROCCAT_MAX_DEVICES);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-04 7:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-02 4:44 [patch] HID: roccat: silence an uninitialized variable warning Dan Carpenter
2016-04-04 7:50 ` 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).