linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Aditya Garg <gargaditya08@live.com>
Cc: linux-input@vger.kernel.org
Subject: [bug report] HID: hid-appletb-kbd: add support for automatic brightness control while using the touchbar
Date: Mon, 17 Feb 2025 00:42:16 +0300	[thread overview]
Message-ID: <6263a1a2-4d50-41db-aa54-cfcb3e0523a4@stanley.mountain> (raw)

Hello Aditya Garg,

Commit 93a0fc489481 ("HID: hid-appletb-kbd: add support for automatic
brightness control while using the touchbar") from Dec 31, 2024
(linux-next), leads to the following Smatch static checker warning:

	drivers/hid/hid-appletb-kbd.c:406 appletb_kbd_probe()
	warn: passing zero to 'dev_err_probe'

drivers/hid/hid-appletb-kbd.c
    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");
                                                   ^^^
s/ret/-EINVAL/?

Why is this indented an extra tab?

    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 

regards,
dan carpenter

             reply	other threads:[~2025-02-16 21:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-16 21:42 Dan Carpenter [this message]
2025-02-17  4:50 ` [bug report] HID: hid-appletb-kbd: add support for automatic brightness control while using the touchbar Aditya Garg
2025-02-17  5:26   ` Dan Carpenter
2025-02-17  5:27   ` Aditya Garg
2025-02-17  7:00     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6263a1a2-4d50-41db-aa54-cfcb3e0523a4@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=gargaditya08@live.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).