mirror of https://gitee.com/openkylin/linux.git
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: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
7901842044
commit
0652940732
|
@ -742,6 +742,10 @@ int __init ghid_setup(struct usb_gadget *g, int count)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
|
|
||||||
hidg_class = class_create(THIS_MODULE, "hidg");
|
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");
|
status = alloc_chrdev_region(&dev, 0, count, "hidg");
|
||||||
if (!status) {
|
if (!status) {
|
||||||
|
|
Loading…
Reference in New Issue