* [bug report] platform/x86: asus-armoury: move existing tunings to asus-armoury module
@ 2025-11-19 7:27 Dan Carpenter
2025-11-19 7:46 ` luke
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2025-11-19 7:27 UTC (permalink / raw)
To: Luke D. Jones; +Cc: platform-driver-x86
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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [bug report] platform/x86: asus-armoury: move existing tunings to asus-armoury module
2025-11-19 7:27 [bug report] platform/x86: asus-armoury: move existing tunings to asus-armoury module Dan Carpenter
@ 2025-11-19 7:46 ` luke
2025-11-20 2:44 ` Denis Benato
0 siblings, 1 reply; 5+ messages in thread
From: luke @ 2025-11-19 7:46 UTC (permalink / raw)
To: Dan Carpenter; +Cc: platform-driver-x86, Denis Benato
I’m not working on this. CCing Denis.
> On 19 Nov 2025, at 20:27, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [bug report] platform/x86: asus-armoury: move existing tunings to asus-armoury module
2025-11-19 7:46 ` luke
@ 2025-11-20 2:44 ` Denis Benato
0 siblings, 0 replies; 5+ messages in thread
From: Denis Benato @ 2025-11-20 2:44 UTC (permalink / raw)
To: luke, Dan Carpenter; +Cc: platform-driver-x86
On 11/19/25 08:46, luke@ljones.dev wrote:
> I’m not working on this. CCing Denis.
>
>> On 19 Nov 2025, at 20:27, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>>
>> 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.
Thank you both for this.
Fix available here: https://lore.kernel.org/all/20251120024059.1341326-1-denis.benato@linux.dev/
>>
>> 431
>> 432 pr_warn("Unrecognized mini-LED mode: %u", mode);
>> 433 return -EINVAL;
>> 434 }
>>
>> regards,
>> dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug report] platform/x86: asus-armoury: move existing tunings to asus-armoury module
@ 2025-11-24 11:53 Dan Carpenter
2025-12-01 5:16 ` luke
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2025-11-24 11:53 UTC (permalink / raw)
To: Luke D. Jones; +Cc: platform-driver-x86
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:147 armoury_has_devstate()
error: uninitialized symbol 'retval'.
drivers/platform/x86/asus-armoury.c
141 static bool armoury_has_devstate(u32 dev_id)
142 {
143 u32 retval;
144 int status;
145
146 status = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, dev_id, 0, &retval);
--> 147 pr_debug("%s called (0x%08x), retval: 0x%08x\n", __func__, dev_id, retval);
^^^^^^
"retval" is uninitialized if asus_wmi_evaluate_method() returns negative.
148
149 return status == 0 && (retval & ASUS_WMI_DSTS_PRESENCE_BIT);
150 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [bug report] platform/x86: asus-armoury: move existing tunings to asus-armoury module
2025-11-24 11:53 Dan Carpenter
@ 2025-12-01 5:16 ` luke
0 siblings, 0 replies; 5+ messages in thread
From: luke @ 2025-12-01 5:16 UTC (permalink / raw)
To: Dan Carpenter; +Cc: platform-driver-x86, Denis Benato
Thank you. As I have not been working on this driver and Denis is taking over I will CC him.
> On 25 Nov 2025, at 00:53, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> 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:147 armoury_has_devstate()
> error: uninitialized symbol 'retval'.
>
> drivers/platform/x86/asus-armoury.c
> 141 static bool armoury_has_devstate(u32 dev_id)
> 142 {
> 143 u32 retval;
> 144 int status;
> 145
> 146 status = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, dev_id, 0, &retval);
> --> 147 pr_debug("%s called (0x%08x), retval: 0x%08x\n", __func__, dev_id, retval);
> ^^^^^^
> "retval" is uninitialized if asus_wmi_evaluate_method() returns negative.
>
> 148
> 149 return status == 0 && (retval & ASUS_WMI_DSTS_PRESENCE_BIT);
> 150 }
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-12-01 5:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 7:27 [bug report] platform/x86: asus-armoury: move existing tunings to asus-armoury module Dan Carpenter
2025-11-19 7:46 ` 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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.