Commit 06529407 authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Felipe Balbi

usb: gadget: f_hid: check return value of class_create

class_create() might fail, so check its return value and react
appropriately.
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 79018420
......@@ -742,6 +742,10 @@ int __init ghid_setup(struct usb_gadget *g, int count)
dev_t dev;
hidg_class = class_create(THIS_MODULE, "hidg");
if (IS_ERR(hidg_class)) {
hidg_class = NULL;
return PTR_ERR(hidg_class);
}
status = alloc_chrdev_region(&dev, 0, count, "hidg");
if (!status) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment