diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-04-02 00:44:32 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2016-04-04 03:49:12 -0400 |
commit | 85d08340c3de1126467db4e69140fe483d91c114 (patch) | |
tree | 8736e4301116f766974e7441a5d58d32c28f7785 | |
parent | d66435cc7da95964cb386674bd82ec12ca66320a (diff) |
HID: roccat: silence an uninitialized variable warning
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>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-roccat.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c index 65c4ccfcbd29..76d06cf87b2a 100644 --- a/drivers/hid/hid-roccat.c +++ b/drivers/hid/hid-roccat.c | |||
@@ -421,14 +421,13 @@ static int __init roccat_init(void) | |||
421 | 421 | ||
422 | retval = alloc_chrdev_region(&dev_id, ROCCAT_FIRST_MINOR, | 422 | retval = alloc_chrdev_region(&dev_id, ROCCAT_FIRST_MINOR, |
423 | ROCCAT_MAX_DEVICES, "roccat"); | 423 | ROCCAT_MAX_DEVICES, "roccat"); |
424 | |||
425 | roccat_major = MAJOR(dev_id); | ||
426 | |||
427 | if (retval < 0) { | 424 | if (retval < 0) { |
428 | pr_warn("can't get major number\n"); | 425 | pr_warn("can't get major number\n"); |
429 | goto error; | 426 | goto error; |
430 | } | 427 | } |
431 | 428 | ||
429 | roccat_major = MAJOR(dev_id); | ||
430 | |||
432 | cdev_init(&roccat_cdev, &roccat_ops); | 431 | cdev_init(&roccat_cdev, &roccat_ops); |
433 | retval = cdev_add(&roccat_cdev, dev_id, ROCCAT_MAX_DEVICES); | 432 | retval = cdev_add(&roccat_cdev, dev_id, ROCCAT_MAX_DEVICES); |
434 | 433 | ||