diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-04-02 07:45:01 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2016-04-04 09:49:12 +0200 |
commit | 6edac6fde59e231bd297ebcbc3d1bd395006cd1d (patch) | |
tree | 492878f8c2df2b2418b4fa3581a1ef7ff2ff8fcb /drivers/hid | |
parent | 85d08340c3de1126467db4e69140fe483d91c114 (diff) |
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hidraw.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 9c2d7c23f296..4b981fd324e8 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -587,14 +587,13 @@ int __init hidraw_init(void) result = alloc_chrdev_region(&dev_id, HIDRAW_FIRST_MINOR, HIDRAW_MAX_DEVICES, "hidraw"); - - hidraw_major = MAJOR(dev_id); - if (result < 0) { pr_warn("can't get major number\n"); goto out; } + hidraw_major = MAJOR(dev_id); + hidraw_class = class_create(THIS_MODULE, "hidraw"); if (IS_ERR(hidraw_class)) { result = PTR_ERR(hidraw_class); |