aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/hid/hidraw.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2012-10-01 14:37:51 +0200
committerJiri Kosina <jkosina@suse.cz>2012-10-01 14:37:51 +0200
commita3cbe10e474ac8c2c30a151a7812e15e4cfa2775 (patch)
treef245dd77a3dede97a80f8369d984334b56220752 /drivers/hid/hidraw.c
parentMerge branches 'from-henrik', 'hidraw', 'logitech', 'picolcd', 'ps3', 'uclogic', 'wacom' and 'wiimote' into for-linus (diff)
parentHID: keep dev_rdesc unmodified and use it for comparisons (diff)
downloadwireguard-linux-a3cbe10e474ac8c2c30a151a7812e15e4cfa2775.tar.xz
wireguard-linux-a3cbe10e474ac8c2c30a151a7812e15e4cfa2775.zip
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)