summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_hid.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index f0545f801c9d..488ac66aae9e 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -972,17 +972,22 @@ int ghid_setup(struct usb_gadget *g, int count)
hidg_class = class_create(THIS_MODULE, "hidg");
if (IS_ERR(hidg_class)) {
+ status = PTR_ERR(hidg_class);
hidg_class = NULL;
- return PTR_ERR(hidg_class);
+ return status;
}
status = alloc_chrdev_region(&dev, 0, count, "hidg");
- if (!status) {
- major = MAJOR(dev);
- minors = count;
+ if (status) {
+ class_destroy(hidg_class);
+ hidg_class = NULL;
+ return status;
}
- return status;
+ major = MAJOR(dev);
+ minors = count;
+
+ return 0;
}
void ghid_cleanup(void)