Skip to content
Commit 944fe915 authored by John Keeping's avatar John Keeping Committed by Greg Kroah-Hartman
Browse files

usb: gadget: f_hid: tidy error handling in hidg_alloc



Unify error handling at the end of the function, reducing the risk of
missing something on one of the error paths.

Moving the increment of opts->refcnt later means there is no need to
decrement it on the error path and is safe as this is guarded by
opts->lock which is held for this entire section.

Tested-by: default avatarLee Jones <lee@kernel.org>
Reviewed-by: default avatarAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Reviewed-by: default avatarLee Jones <lee@kernel.org>
Signed-off-by: default avatarJohn Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/20221122123523.3068034-4-john@metanate.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 70a3288a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment