diff options
author | He Lugang <helugang@uniontech.com> | 2024-09-25 08:28:24 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.com> | 2024-10-18 12:50:08 +0200 |
commit | 2e592244c4874c5e7808ac27f62443e8ff87d901 (patch) | |
tree | cae9317c0959ba36501205acaa75b5552206655c /drivers/hid/hid-cp2112.c | |
parent | Merge tag 'hid-for-linus-2024101301' of git://git.kernel.org/pub/scm/linux/ke... (diff) | |
download | linux-2e592244c4874c5e7808ac27f62443e8ff87d901.tar.xz linux-2e592244c4874c5e7808ac27f62443e8ff87d901.zip |
HID: replace BUG_ON() with WARN_ON()
There is no need to kill the system entirely in HID with BUG_ON,
use WARN_ON to handle fault more gracefully which allow the system
to keep running.
Signed-off-by: He Lugang <helugang@uniontech.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'drivers/hid/hid-cp2112.c')
-rw-r--r-- | drivers/hid/hid-cp2112.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index dae2b84a1490..f4c8d981aa0a 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -852,7 +852,8 @@ static int cp2112_set_usb_config(struct hid_device *hdev, { int ret; - BUG_ON(cfg->report != CP2112_USB_CONFIG); + if (WARN_ON(cfg->report != CP2112_USB_CONFIG)) + return -EINVAL; ret = cp2112_hid_output(hdev, (u8 *)cfg, sizeof(*cfg), HID_FEATURE_REPORT); |