public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Denis Benato <denis.benato@linux.dev>
To: linux-kernel@vger.kernel.org
Cc: platform-driver-x86@vger.kernel.org,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Limonciello, Mario" <mario.limonciello@amd.com>,
	"Luke D . Jones" <luke@ljones.dev>,
	"Alok Tiwari" <alok.a.tiwari@oracle.com>,
	"Derek John Clark" <derekjohn.clark@gmail.com>,
	"Mateusz Schyboll" <dragonn@op.pl>,
	porfet828@gmail.com, "Denis Benato" <benato.denis96@gmail.com>,
	"Dan Carpenter" <dan.carpenter@linaro.org>,
	"Denis Benato" <denis.benato@linux.dev>
Subject: [PATCH] platform/x86: asus-armoury: fix mini-led mode show
Date: Thu, 20 Nov 2025 03:40:59 +0100	[thread overview]
Message-ID: <20251120024059.1341326-1-denis.benato@linux.dev> (raw)

Perform the actual check of the mini-led mode against supported modes and do not return the first one regardless of the WMI devstate.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/aR1xbxEQyQPEvB9o@stanley.mountain/
Signed-off-by: Denis Benato <denis.benato@linux.dev>
---
 drivers/platform/x86/asus-armoury.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asus-armoury.c
index d6aba68515e2..c4919f3bf4b2 100644
--- a/drivers/platform/x86/asus-armoury.c
+++ b/drivers/platform/x86/asus-armoury.c
@@ -373,7 +373,8 @@ static ssize_t mini_led_mode_current_value_show(struct kobject *kobj,
 	mode = FIELD_GET(ASUS_MINI_LED_MODE_MASK, 0);
 
 	for (i = 0; i < mini_led_mode_map_size; i++)
-		return sysfs_emit(buf, "%u\n", mini_led_mode_map[i]);
+		if (mode == mini_led_mode_map[i])
+			return sysfs_emit(buf, "%u\n", i);
 
 	pr_warn("Unrecognized mini-LED mode: %u", mode);
 	return -EINVAL;
-- 
2.52.0


             reply	other threads:[~2025-11-20  2:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20  2:40 Denis Benato [this message]
2025-11-21 15:28 ` [PATCH] platform/x86: asus-armoury: fix mini-led mode show Ilpo Järvinen
2025-11-21 19:57   ` Denis Benato

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=20251120024059.1341326-1-denis.benato@linux.dev \
    --to=denis.benato@linux.dev \
    --cc=alok.a.tiwari@oracle.com \
    --cc=benato.denis96@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=derekjohn.clark@gmail.com \
    --cc=dragonn@op.pl \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --cc=mario.limonciello@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=porfet828@gmail.com \
    /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