X86 platform drivers
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: "Luke D. Jones" <luke@ljones.dev>
Cc: platform-driver-x86@vger.kernel.org
Subject: [bug report] platform/x86: asus-armoury: move existing tunings to asus-armoury module
Date: Wed, 19 Nov 2025 10:27:43 +0300	[thread overview]
Message-ID: <aR1xbxEQyQPEvB9o@stanley.mountain> (raw)

Hello Luke D. Jones,

Commit f99eb098090e ("platform/x86: asus-armoury: move existing
tunings to asus-armoury module") from Nov 2, 2025 (linux-next), leads
to the following Smatch static checker warning:

	drivers/platform/x86/asus-armoury.c:429 mini_led_mode_current_value_show()
	warn: iterator 'i' not incremented

drivers/platform/x86/asus-armoury.c
    399 static ssize_t mini_led_mode_current_value_show(struct kobject *kobj,
    400                                                 struct kobj_attribute *attr, char *buf)
    401 {
    402         u32 *mini_led_mode_map;
    403         size_t mini_led_mode_map_size;
    404         u32 i, mode;
    405         int err;
    406 
    407         switch (asus_armoury.mini_led_dev_id) {
    408         case ASUS_WMI_DEVID_MINI_LED_MODE:
    409                 mini_led_mode_map = mini_led_mode1_map;
    410                 mini_led_mode_map_size = ARRAY_SIZE(mini_led_mode1_map);
    411                 break;
    412 
    413         case ASUS_WMI_DEVID_MINI_LED_MODE2:
    414                 mini_led_mode_map = mini_led_mode2_map;
    415                 mini_led_mode_map_size = ARRAY_SIZE(mini_led_mode2_map);
    416                 break;
    417 
    418         default:
    419                 pr_err("Unrecognized mini-LED device: %u\n", asus_armoury.mini_led_dev_id);
    420                 return -ENODEV;
    421         }
    422 
    423         err = armoury_get_devstate(attr, &mode, asus_armoury.mini_led_dev_id);
    424         if (err)
    425                 return err;
    426 
    427         mode = FIELD_GET(ASUS_MINI_LED_MODE_MASK, 0);
    428 
--> 429         for (i = 0; i < mini_led_mode_map_size; i++)
    430                 return sysfs_emit(buf, "%u\n", mini_led_mode_map[i]);

This loop doesn't make sense.  It just prints the first element in
the mini_led_mode_map[] array and returns.

    431 
    432         pr_warn("Unrecognized mini-LED mode: %u", mode);
    433         return -EINVAL;
    434 }

regards,
dan carpenter

             reply	other threads:[~2025-11-19  7:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19  7:27 Dan Carpenter [this message]
2025-11-19  7:46 ` [bug report] platform/x86: asus-armoury: move existing tunings to asus-armoury module luke
2025-11-20  2:44   ` Denis Benato
  -- strict thread matches above, loose matches on Subject: below --
2025-11-24 11:53 Dan Carpenter
2025-12-01  5:16 ` luke

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=aR1xbxEQyQPEvB9o@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=luke@ljones.dev \
    --cc=platform-driver-x86@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