Skip to content

Commit 2c863db

Browse files
Ethan Tidmoregregkh
authored andcommitted
usb: gadget: f_hid: Add missing error code
Currently in cdev_alloc() error path no error code is assigned. Assign error code '-ENOMEM'. Detected by Smatch: drivers/usb/gadget/function/f_hid.c:1291 hidg_bind() warn: missing error code 'status' Fixes: 81ebd43 ("usb: gadget: f_hid: don't call cdev_init while cdev in use") Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com> Acked-by: Peter Korsgaard <peter@korsgaard.com> Reviewed-by: Michael Zimmermann <sigmaepsilon92@gmail.com> Link: https://patch.msgid.link/20260402180008.64233-1-ethantidmore06@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 40b17a3 commit 2c863db

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/usb/gadget/function/f_hid.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,8 +1278,10 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
12781278

12791279
/* create char device */
12801280
hidg->cdev = cdev_alloc();
1281-
if (!hidg->cdev)
1281+
if (!hidg->cdev) {
1282+
status = -ENOMEM;
12821283
goto fail_free_all;
1284+
}
12831285
hidg->cdev->ops = &f_hidg_fops;
12841286

12851287
status = cdev_device_add(hidg->cdev, &hidg->dev);

0 commit comments

Comments
 (0)