提交 6edac6fd 编写于 作者: D Dan Carpenter 提交者: Jiri Kosina

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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 85d08340
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册