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

HID: hidraw: silence an uninitialized variable warning

My static checker complains that "devid" can be uninitialized if
alloc_chrdev_region() fails. Fix this by moving the error hanling
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
6edac6fd 85d08340

+2 -3
+2 -3
drivers/hid/hidraw.c
··· 587 587 588 588 result = alloc_chrdev_region(&dev_id, HIDRAW_FIRST_MINOR, 589 589 HIDRAW_MAX_DEVICES, "hidraw"); 590 - 591 - hidraw_major = MAJOR(dev_id); 592 - 593 590 if (result < 0) { 594 591 pr_warn("can't get major number\n"); 595 592 goto out; 596 593 } 594 + 595 + hidraw_major = MAJOR(dev_id); 597 596 598 597 hidraw_class = class_create(THIS_MODULE, "hidraw"); 599 598 if (IS_ERR(hidraw_class)) {