diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2014-11-06 11:11:56 +0100 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-11-06 16:18:17 -0600 |
commit | 06529407329841ed836b30e4a99905a522ffa323 (patch) | |
tree | 4cbd13a896db04513fb85654ad0d998a2fdd8279 /drivers/usb/gadget | |
parent | 79018420441bbbc2b567d891fc3d12ad69f1cd5f (diff) |
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>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/function/f_hid.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 59ab62c92b66..f3b3e19281ea 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c @@ -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) { |