summaryrefslogtreecommitdiff
path: root/drivers/hid/hidraw.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2012-10-01 16:37:51 +0400
committerJiri Kosina <jkosina@suse.cz>2012-10-01 16:37:51 +0400
commita3cbe10e474ac8c2c30a151a7812e15e4cfa2775 (patch)
treef245dd77a3dede97a80f8369d984334b56220752 /drivers/hid/hidraw.c
parentfa2bd30159499f441125495ba8d9d57f646ea42a (diff)
parent86e6b77eb7cf9ca2e9c7092b4dfd588f0a3307b6 (diff)
downloadlinux-a3cbe10e474ac8c2c30a151a7812e15e4cfa2775.tar.xz
Merge branch 'upstream' into for-linus
Conflicts: drivers/hid/usbhid/hid-quirks.c
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r--drivers/hid/hidraw.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index c46c5f1037f4..17d15bb610d1 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -522,21 +522,28 @@ int __init hidraw_init(void)
if (result < 0) {
pr_warn("can't get major number\n");
- result = 0;
goto out;
}
hidraw_class = class_create(THIS_MODULE, "hidraw");
if (IS_ERR(hidraw_class)) {
result = PTR_ERR(hidraw_class);
- unregister_chrdev(hidraw_major, "hidraw");
- goto out;
+ goto error_cdev;
}
cdev_init(&hidraw_cdev, &hidraw_ops);
- cdev_add(&hidraw_cdev, dev_id, HIDRAW_MAX_DEVICES);
+ result = cdev_add(&hidraw_cdev, dev_id, HIDRAW_MAX_DEVICES);
+ if (result < 0)
+ goto error_class;
+
out:
return result;
+
+error_class:
+ class_destroy(hidraw_class);
+error_cdev:
+ unregister_chrdev_region(dev_id, HIDRAW_MAX_DEVICES);
+ goto out;
}
void hidraw_exit(void)