From: Dan Carpenter Date: Sat, 2 Apr 2016 04:44:32 +0000 (+0300) Subject: HID: roccat: silence an uninitialized variable warning X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=85d08340c3de1126467db4e69140fe483d91c114;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Jiri Kosina --- 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) 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);