Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dan Carpenter and committed by
Jiri Kosina
85d08340 d66435cc

+2 -3
+2 -3
drivers/hid/hid-roccat.c
··· 421 421 422 422 retval = alloc_chrdev_region(&dev_id, ROCCAT_FIRST_MINOR, 423 423 ROCCAT_MAX_DEVICES, "roccat"); 424 - 425 - roccat_major = MAJOR(dev_id); 426 - 427 424 if (retval < 0) { 428 425 pr_warn("can't get major number\n"); 429 426 goto error; 430 427 } 428 + 429 + roccat_major = MAJOR(dev_id); 431 430 432 431 cdev_init(&roccat_cdev, &roccat_ops); 433 432 retval = cdev_add(&roccat_cdev, dev_id, ROCCAT_MAX_DEVICES);