Skip to content

Commit ffca1be

Browse files
author
Jiri Kosina
committed
Merge branch 'for-6.13/bug-on-to-warn-on' into for-linus
- removal of three way-too-aggressive BUG_ON()s from HID drivers (He Lugang)
2 parents 22380b5 + 2e59224 commit ffca1be

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/hid/hid-cp2112.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,8 @@ static int cp2112_set_usb_config(struct hid_device *hdev,
852852
{
853853
int ret;
854854

855-
BUG_ON(cfg->report != CP2112_USB_CONFIG);
855+
if (WARN_ON(cfg->report != CP2112_USB_CONFIG))
856+
return -EINVAL;
856857

857858
ret = cp2112_hid_output(hdev, (u8 *)cfg, sizeof(*cfg),
858859
HID_FEATURE_REPORT);

drivers/hid/hid-lg4ff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,8 @@ int lg4ff_init(struct hid_device *hid)
13501350

13511351
/* Initialize device properties */
13521352
if (mmode_ret == LG4FF_MMODE_IS_MULTIMODE) {
1353-
BUG_ON(mmode_idx == -1);
1353+
if (WARN_ON(mmode_idx == -1))
1354+
return -EINVAL;
13541355
mmode_wheel = &lg4ff_multimode_wheels[mmode_idx];
13551356
}
13561357
lg4ff_init_wheel_data(&entry->wdata, &lg4ff_devices[i], mmode_wheel, real_product_id);

drivers/hid/hid-sony.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,8 @@ static int sony_leds_init(struct sony_sc *sc)
13791379
u8 max_brightness[MAX_LEDS] = { [0 ... (MAX_LEDS - 1)] = 1 };
13801380
u8 use_hw_blink[MAX_LEDS] = { 0 };
13811381

1382-
BUG_ON(!(sc->quirks & SONY_LED_SUPPORT));
1382+
if (WARN_ON(!(sc->quirks & SONY_LED_SUPPORT)))
1383+
return -EINVAL;
13831384

13841385
if (sc->quirks & BUZZ_CONTROLLER) {
13851386
sc->led_count = 4;

0 commit comments

Comments
 (0)