mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Emre Cecanpunar <emreleno@gmail.com>
To: platform-driver-x86@vger.kernel.org, hansg@kernel.org,
	ilpo.jarvinen@linux.intel.com
Cc: linux-kernel@vger.kernel.org, krishna.chomal108@gmail.com,
	radheykalra901@gmail.com, edip@medip.dev, hello@kursatabayli.dev,
	mjg59@srcf.ucam.org, akpm@linux-foundation.org,
	jorge.lopez2@hp.com, jes965@nyu.edu, mario.limonciello@amd.com,
	julien.robin28@free.fr, Emre Cecanpunar <emreleno@gmail.com>
Subject: [PATCH 3/5] platform/x86: hp-wmi: handle errors in the OMEN key event
Date: Thu, 16 Jul 2026 12:54:16 +0300	[thread overview]
Message-ID: <80d2021166a4e71453d366012598f5f4ac2f2c34.1784195117.git.emreleno@gmail.com> (raw)
In-Reply-To: <cover.1784195117.git.emreleno@gmail.com>

hp_wmi_read_int() can return a negative error code, but the
HPWMI_OMEN_KEY handler passes it directly to
sparse_keymap_report_event(). The value is then converted to an unsigned
key code, causing a bogus lookup and a KEY_UNKNOWN input event.

Stop processing the event when reading the key code fails, mirroring the
existing check in the HPWMI_BEZEL_BUTTON handler.

Fixes: f4a31a428d0d ("platform/x86: hp-wmi: Add HP Envy special key support")
Signed-off-by: Emre Cecanpunar <emreleno@gmail.com>
---
 drivers/platform/x86/hp/hp-wmi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index e226b772ef00..29881749aae6 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -1253,10 +1253,14 @@ static void hp_wmi_notify(union acpi_object *obj, void *context)
 		platform_profile_cycle();
 		break;
 	case HPWMI_OMEN_KEY:
-		if (event_data) /* Only should be true for HP Omen */
+		if (event_data) {
+			/* Only should be true for HP Omen */
 			key_code = event_data;
-		else
+		} else {
 			key_code = hp_wmi_read_int(HPWMI_HOTKEY_QUERY);
+			if (key_code < 0)
+				break;
+		}
 
 		if (!sparse_keymap_report_event(hp_wmi_input_dev,
 						key_code, 1, true))

  parent reply	other threads:[~2026-07-16  9:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  9:54 [PATCH 0/5] platform/x86: hp-wmi: Fix WMI error handling Emre Cecanpunar
2026-07-16  9:54 ` [PATCH 1/5] platform/x86: hp-wmi: validate WMI response header size Emre Cecanpunar
2026-07-21 15:42   ` Ilpo Järvinen
2026-07-16  9:54 ` [PATCH 2/5] platform/x86: hp-wmi: handle firmware errors in tablet mode query Emre Cecanpunar
2026-07-21 15:50   ` Ilpo Järvinen
2026-07-16  9:54 ` Emre Cecanpunar [this message]
2026-07-21 15:52   ` [PATCH 3/5] platform/x86: hp-wmi: handle errors in the OMEN key event Ilpo Järvinen
2026-07-16  9:54 ` [PATCH 4/5] platform/x86: hp-wmi: normalize GPU thermal mode errors Emre Cecanpunar
2026-07-21 15:57   ` Ilpo Järvinen
2026-07-16  9:54 ` [PATCH 5/5] platform/x86: hp-wmi: report fan speed command failures Emre Cecanpunar
2026-07-21 15:58   ` Ilpo Järvinen
2026-07-21 16:14 ` [PATCH 0/5] platform/x86: hp-wmi: Fix WMI error handling Emre Cecanpunar
2026-07-21 16:15 ` Emre Cecanpunar

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=80d2021166a4e71453d366012598f5f4ac2f2c34.1784195117.git.emreleno@gmail.com \
    --to=emreleno@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=edip@medip.dev \
    --cc=hansg@kernel.org \
    --cc=hello@kursatabayli.dev \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jes965@nyu.edu \
    --cc=jorge.lopez2@hp.com \
    --cc=julien.robin28@free.fr \
    --cc=krishna.chomal108@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=radheykalra901@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

all inboxes | Powered by JetHome®