提交 85d08340 编写于 作者: D Dan Carpenter 提交者: Jiri Kosina

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