drivers/hid/hid-appletb-kbd.c:405 appletb_kbd_probe() warn: inconsistent indenting
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 0ae0fa3bf0b44c8611d114a9f69985bf451010c3 commit: 93a0fc48948107e0cc34e1de22c3cb363a8f2783 [1810/4011] HID: hid-appletb-kbd: add support for automatic brightness control while using the touchbar config: parisc-randconfig-r072-20250215 (https://download.01.org/0day-ci/archive/20250215/[email protected]/config) compiler: hppa-linux-gcc (GCC) 14.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
smatch warnings:drivers/hid/hid-appletb-kbd.c:405 appletb_kbd_probe() warn: inconsistent indenting drivers/hid/hid-appletb-kbd.c:406 appletb_kbd_probe() warn: passing zero to 'dev_err_probe'
vim +405 drivers/hid/hid-appletb-kbd.c
371
372 static int appletb_kbd_probe(struct hid_device *hdev, const struct hid_device_id *id)
373 {
374 struct appletb_kbd *kbd;
375 struct device *dev = &hdev->dev;
376 struct hid_field *mode_field;
377 int ret;
378
379 ret = hid_parse(hdev);
380 if (ret)
381 return dev_err_probe(dev, ret, "HID parse failed\n");
382
383 mode_field = hid_find_field(hdev, HID_OUTPUT_REPORT,
384 HID_GD_KEYBOARD, HID_USAGE_MODE);
385 if (!mode_field)
386 return -ENODEV;
387
388 kbd = devm_kzalloc(dev, sizeof(*kbd), GFP_KERNEL);
389 if (!kbd)
390 return -ENOMEM;
391
392 kbd->mode_field = mode_field;
393
394 ret = hid_hw_start(hdev, HID_CONNECT_HIDINPUT);
395 if (ret)
396 return dev_err_probe(dev, ret, "HID hw start failed\n");
397
398 ret = hid_hw_open(hdev);
399 if (ret) {
400 dev_err_probe(dev, ret, "HID hw open failed\n");
401 goto stop_hw;
402 }
403
404 kbd->backlight_dev = backlight_device_get_by_name("appletb_backlight");
> 405 if (!kbd->backlight_dev) > 406 dev_err_probe(dev, ret, "Failed to get backlight device\n");
407 else {
408 backlight_device_set_brightness(kbd->backlight_dev, 2);
409 timer_setup(&kbd->inactivity_timer, appletb_inactivity_timer, 0);
410 mod_timer(&kbd->inactivity_timer, jiffies + msecs_to_jiffies(appletb_tb_dim_timeout * 1000));
411 }
412
413 kbd->inp_handler.event = appletb_kbd_inp_event;
414 kbd->inp_handler.connect = appletb_kbd_inp_connect;
415 kbd->inp_handler.disconnect = appletb_kbd_inp_disconnect;
416 kbd->inp_handler.name = "appletb";
417 kbd->inp_handler.id_table = appletb_kbd_input_devices;
418 kbd->inp_handler.match = appletb_kbd_match_internal_device;
419 kbd->inp_handler.private = kbd;
420
421 ret = input_register_handler(&kbd->inp_handler);
422 if (ret) {
423 dev_err_probe(dev, ret, "Unable to register keyboard handler\n");
424 goto close_hw;
425 }
426
427 ret = appletb_kbd_set_mode(kbd, appletb_tb_def_mode);
428 if (ret) {
429 dev_err_probe(dev, ret, "Failed to set touchbar mode\n");
430 goto close_hw;
431 }
432
433 hid_set_drvdata(hdev, kbd);
434
435 return 0;
436
437 close_hw:
438 hid_hw_close(hdev);
439 stop_hw:
440 hid_hw_stop(hdev);
441 return ret;
442 }
443
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Fixes sent here:
https://lore.kernel.org/linux-input/[email protected]/T/#u
Quoted 83 lines
smatch warnings:
drivers/hid/hid-appletb-kbd.c:405appletb_kbd_probe()warn: inconsistent indentingdrivers/hid/hid-appletb-kbd.c:406appletb_kbd_probe()warn: passing zero to 'dev_err_probe'vim +405
drivers/hid/hid-appletb-kbd.c371
372 static intappletb_kbd_probe(struct hid_device *hdev, const struct hid_device_id *id)373 {
374 structappletb_kbd*kbd;
375 struct device *dev =&hdev->dev;
376 structhid_field*mode_field;
377 int ret;
378
379 ret =hid_parse(hdev);
380 if (ret)
381 returndev_err_probe(dev, ret, "HID parse failed\n");
382
383mode_field= hid_find_field(hdev,HID_OUTPUT_REPORT,
384HID_GD_KEYBOARD,HID_USAGE_MODE);
385 if (!mode_field)
386 return-ENODEV;
387
388 kbd =devm_kzalloc(dev, sizeof(*kbd), GFP_KERNEL);
389 if (!kbd)
390 return-ENOMEM;
391
392kbd->mode_field=mode_field;
393
394 ret =hid_hw_start(hdev, HID_CONNECT_HIDINPUT);
395 if (ret)
396 returndev_err_probe(dev, ret, "HID hw start failed\n");
397
398 ret =hid_hw_open(hdev);
399 if (ret) {
400dev_err_probe(dev, ret, "HID hw open failed\n");
401 gotostop_hw;
402 }
403
404kbd->backlight_dev=backlight_device_get_by_name("appletb_backlight");Quoted 2 lines
405 if (!kbd->backlight_dev)
406dev_err_probe(dev, ret, "Failed to get backlight device\n");407 else {
408backlight_device_set_brightness(kbd->backlight_dev, 2);
409timer_setup(&kbd->inactivity_timer, appletb_inactivity_timer, 0);
410mod_timer(&kbd->inactivity_timer, jiffies + msecs_to_jiffies(appletb_tb_dim_timeout * 1000)); 411 }
412
413kbd->inp_handler.event=appletb_kbd_inp_event;
414kbd->inp_handler.connect=appletb_kbd_inp_connect;
415kbd->inp_handler.disconnect=appletb_kbd_inp_disconnect;
416kbd->inp_handler.name= "appletb";
417kbd->inp_handler.id_table=appletb_kbd_input_devices;
418kbd->inp_handler.match=appletb_kbd_match_internal_device;
419kbd->inp_handler.private= kbd;
420
421 ret =input_register_handler(&kbd->inp_handler);
422 if (ret) {
423dev_err_probe(dev, ret, "Unable to register keyboard handler\n");
424 gotoclose_hw;
425 }
426
427 ret =appletb_kbd_set_mode(kbd, appletb_tb_def_mode);
428 if (ret) {
429dev_err_probe(dev, ret, "Failed to set touchbar mode\n");
430 gotoclose_hw;
431 }
432
433hid_set_drvdata(hdev, kbd);
434
435 return 0;
436
437close_hw:
438hid_hw_close(hdev);
439stop_hw:
440hid_hw_stop(hdev);
441 return ret;
442 }
443Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
A revised version sent here:
https://lore.kernel.org/linux-input/[email protected]/
Quoted 90 lines · Aditya Garg
Fixes sent here:
https://lore.kernel.org/linux-input/[email protected]/T/#u
Quoted 83 lines
smatch warnings:
drivers/hid/hid-appletb-kbd.c:405appletb_kbd_probe()warn: inconsistent indentingdrivers/hid/hid-appletb-kbd.c:406appletb_kbd_probe()warn: passing zero to 'dev_err_probe'vim +405
drivers/hid/hid-appletb-kbd.c371
372 static intappletb_kbd_probe(struct hid_device *hdev, const struct hid_device_id *id)373 {
374 structappletb_kbd*kbd;
375 struct device *dev =&hdev->dev;
376 structhid_field*mode_field;
377 int ret;
378
379 ret =hid_parse(hdev);
380 if (ret)
381 returndev_err_probe(dev, ret, "HID parse failed\n");
382
383mode_field= hid_find_field(hdev,HID_OUTPUT_REPORT,
384HID_GD_KEYBOARD,HID_USAGE_MODE);
385 if (!mode_field)
386 return-ENODEV;
387
388 kbd =devm_kzalloc(dev, sizeof(*kbd), GFP_KERNEL);
389 if (!kbd)
390 return-ENOMEM;
391
392kbd->mode_field=mode_field;
393
394 ret =hid_hw_start(hdev, HID_CONNECT_HIDINPUT);
395 if (ret)
396 returndev_err_probe(dev, ret, "HID hw start failed\n");
397
398 ret =hid_hw_open(hdev);
399 if (ret) {
400dev_err_probe(dev, ret, "HID hw open failed\n");
401 gotostop_hw;
402 }
403
404kbd->backlight_dev=backlight_device_get_by_name("appletb_backlight");Quoted 2 lines
405 if (!kbd->backlight_dev)
406dev_err_probe(dev, ret, "Failed to get backlight device\n");407 else {
408backlight_device_set_brightness(kbd->backlight_dev, 2);
409timer_setup(&kbd->inactivity_timer, appletb_inactivity_timer, 0);
410mod_timer(&kbd->inactivity_timer, jiffies + msecs_to_jiffies(appletb_tb_dim_timeout * 1000)); 411 }
412
413kbd->inp_handler.event=appletb_kbd_inp_event;
414kbd->inp_handler.connect=appletb_kbd_inp_connect;
415kbd->inp_handler.disconnect=appletb_kbd_inp_disconnect;
416kbd->inp_handler.name= "appletb";
417kbd->inp_handler.id_table=appletb_kbd_input_devices;
418kbd->inp_handler.match=appletb_kbd_match_internal_device;
419kbd->inp_handler.private= kbd;
420
421 ret =input_register_handler(&kbd->inp_handler);
422 if (ret) {
423dev_err_probe(dev, ret, "Unable to register keyboard handler\n");
424 gotoclose_hw;
425 }
426
427 ret =appletb_kbd_set_mode(kbd, appletb_tb_def_mode);
428 if (ret) {
429dev_err_probe(dev, ret, "Failed to set touchbar mode\n");
430 gotoclose_hw;
431 }
432
433hid_set_drvdata(hdev, kbd);
434
435 return 0;
436
437close_hw:
438hid_hw_close(hdev);
439stop_hw:
440hid_hw_stop(hdev);
441 return ret;
442 }
443Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki