From nobody Sat Apr 18 09:30:45 2026 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AFD643E9C7 for ; Sat, 28 Feb 2026 14:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772290001; cv=none; b=aGUNcb13NJFR2nCHi5bI8ZyXvUqb9WUW0tbUL1XDj+fo2Z6S+yxNtXzSqVPoQcf5PI+jpvsPZMYnWTvDdeA/LXSbVwfiUzPf/hiAfkajVgOMB+r0EWP5sv1MlUvSeBJqxDkKOrI1jREsFFbJPyoERr7ftZqJ2NZO16htyljyjbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772290001; c=relaxed/simple; bh=zgNG83WO+5qFxYkeXCc8cWN8flAQFaJPnmP22z8TkWw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EVlfgY8tANjxK6MphVs1zJJ8S001EhfT3kbGUTzRe4zsaLZhbE4DkuU55J/zb1sdufmxjnnJCYrEAO2RnHvbqeRC6XIUNeNC3ba7luTEZsbyJb6Y82EtOtym07josEYQi/plIJwyM4AktilliKeJ4tQvGdzuK6Br1g9C/jCWmqM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=XpOQ2JIJ; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="XpOQ2JIJ" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772289990; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d8ZWoUXilN7rq9eoSEwgxiKdI4SoSqyZwtNrXIWLO24=; b=XpOQ2JIJMF+awRkByumNkmXb5W9apC9Cae87XpYFDIqnGsNvfSop3c3gXCOIcJ1U/TK0Ph lkM0OWTPcsdlhBkmxw9/pM4AX6IXXbZuhZoty2FmStdAxHbjcnXlBKKHZ7XQWqXXaeBQiS YVmOjkqSPyCgSeWVRyZQMHRoz3GWNzU= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH 1/7] HID: asus: fix code style of comments and brackets Date: Sat, 28 Feb 2026 15:46:20 +0100 Message-ID: <20260228144626.1661530-2-denis.benato@linux.dev> In-Reply-To: <20260228144626.1661530-1-denis.benato@linux.dev> References: <20260228144626.1661530-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" In asus_raw_event there is code that would violate checkpatch script such as unaligned closing comments and superfluous graph parenthesis: fix these stylistic issues. Also remove an empty comment spanning two lines. This commit does not change runtime behavior. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index ffbfaff9f117..5fcb06b16167 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -20,9 +20,6 @@ * Copyright (c) 2016 Frederik Wenigwieser */ =20 -/* - */ - #include #include #include @@ -359,7 +356,7 @@ static int asus_event(struct hid_device *hdev, struct h= id_field *field, struct hid_usage *usage, __s32 value) { struct asus_drvdata *drvdata =3D hid_get_drvdata(hdev); -=09 + if ((usage->hid & HID_USAGE_PAGE) =3D=3D HID_UP_ASUSVENDOR && (usage->hid & HID_USAGE) !=3D 0x00 && (usage->hid & HID_USAGE) !=3D 0xff && !usage->type) { @@ -448,21 +445,18 @@ static int asus_raw_event(struct hid_device *hdev, /* * G713 and G733 send these codes on some keypresses, depending on * the key pressed it can trigger a shutdown event if not caught. - */ - if (data[0] =3D=3D 0x02 && data[1] =3D=3D 0x30) { + */ + if (data[0] =3D=3D 0x02 && data[1] =3D=3D 0x30) return -1; - } } =20 if (drvdata->quirks & QUIRK_ROG_CLAYMORE_II_KEYBOARD) { /* * CLAYMORE II keyboard sends this packet when it goes to sleep * this causes the whole system to go into suspend. - */ - - if(size =3D=3D 2 && data[0] =3D=3D 0x02 && data[1] =3D=3D 0x00) { + */ + if (size =3D=3D 2 && data[0] =3D=3D 0x02 && data[1] =3D=3D 0x00) return -1; - } } =20 return 0; --=20 2.53.0 From nobody Sat Apr 18 09:30:45 2026 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C7F043CED1 for ; Sat, 28 Feb 2026 14:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289995; cv=none; b=egWJsAjsehaVfSQLc7B2wqOmrcvKL4KXoEARdHwktA5YJnaOMvn9QdA7iooNDjjKB839GByfj40u01bO+aOBpVFTljQ5mpUO9wweDjti/ht7VMriKtSsaPoJRVSU/kG91SRRtA0/mqLeH5CtM3H1cz06QXR/oIi8axB7lAN2VT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289995; c=relaxed/simple; bh=UkDBhIPsFIFYiXHUVq8yfYf8INQMI/qy7cSepFB2xJs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=inymlE+ly4+izDi2AvVqeca8/pWIahQ35bnBq1WTxteBrKhNRCvLsFXGdT+AzHr3ZSHnG78ME3uyJzekcrKX3XYdloQRo5TnoclxeksDIjtfQ9j3CLyR+ev/f95E7YlgZSDoH1KZ/ieCbJUh0WOnj3UEfqnrhIa3I4LF7J0z2yI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=fggtjR/4; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="fggtjR/4" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772289992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k/6nhFAzqdch83HyRN7Z7ZoNORIKsdmbyNN7EKa4jaY=; b=fggtjR/4h/URziKpVHs5RNnc9s0avTiNYtO3d2MSii/H7rauiDRBlSN3qTnSqchGSb6mYi +/7ey8RNdUWh5Qt/zoxOMGEuCV+Jf5+zz4txh06y/osA7fzwEgslDx2McYBio6L8cfnHwI pbtnet8ICspLWOvJrwtL+mVhoLIDboM= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH 2/7] HID: asus: add xg mobile 2022 external hardware support Date: Sat, 28 Feb 2026 15:46:21 +0100 Message-ID: <20260228144626.1661530-3-denis.benato@linux.dev> In-Reply-To: <20260228144626.1661530-1-denis.benato@linux.dev> References: <20260228144626.1661530-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" XG mobile station 2022 has a different PID than the 2023 model: add it that model to hid-asus. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 3 +++ drivers/hid/hid-ids.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 5fcb06b16167..fbcf38b15290 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1515,6 +1515,9 @@ static const struct hid_device_id asus_devices[] =3D { { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY_X), QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD | QUIRK_ROG_ALLY_XPAD= }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, + USB_DEVICE_ID_ASUSTEK_XGM_2022), + }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_XGM_2023), }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 4ab7640b119a..5e85921049e0 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -229,6 +229,7 @@ #define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY_X 0x1b4c #define USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD 0x196b #define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD 0x1869 +#define USB_DEVICE_ID_ASUSTEK_XGM_2022 0x1970 #define USB_DEVICE_ID_ASUSTEK_XGM_2023 0x1a9a =20 #define USB_VENDOR_ID_ATEN 0x0557 --=20 2.53.0 From nobody Sat Apr 18 09:30:45 2026 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A6B643D51C for ; Sat, 28 Feb 2026 14:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289998; cv=none; b=Mx8XA6brF1XamCzhLnbFZ1hNNHwgd5aULMnadiF4pGjU1wDaQyyQsJ/MKQExzBbD6/Nrng0hf0LdmwyTH6xbOpyGt9C4ANgktTC9KoQKVZ32K+QieB8o3xzX375wh1QH0w14B9k2i+KW9SK0JqHB+/knFG9xeIexN3eOQBOOhbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289998; c=relaxed/simple; bh=yHtNrxb6RKeEMvwyoM6DYSEQq5BjHIRjmQEhkK00GiU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qNYpGytLsQo/VdkS+d/qNq7LsvizQnSppjFmGrZUTLE9sV156nmSqgHVgfBVcR8nOQFcdSlozmmW33nVU82MCWa2GOasHQD7YUnXanmw8wDtsGU7EIOSy/xnGgESG39o0OEv0632z82Fxq+nslsLcnXrCpc2oZk8oeTQSyFkODk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ss3/BGAc; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ss3/BGAc" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772289995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cZ0ptMQdDcnwROywUM/EVbQICnD3WeNoaINlJhVc+bo=; b=ss3/BGAcPpCzdcOPu/CyY9Cua7jbp5SL/vEETSKOWdA4kYg1ItiIh4Sm5x8ErnRbn9NYq/ ZUlAlDjMzuH57co4n3F5HEQMW1ZHg1u3/vr1Q1eM1a31DcxTKjWvoJyWaOYKdJe4zjmMad BlNBXbRzMPCI3ADK0IfBZ08G0iR56qc= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH 3/7] HID: asus: fix compiler warning about unused variables Date: Sat, 28 Feb 2026 15:46:22 +0100 Message-ID: <20260228144626.1661530-4-denis.benato@linux.dev> In-Reply-To: <20260228144626.1661530-1-denis.benato@linux.dev> References: <20260228144626.1661530-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" In the function asus_has_report_id there are 3 unused variables clang warns about: remove them. Fixes:0919db9f3583 ("HID: asus: always fully initialize devices") Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index fbcf38b15290..2b4411399571 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -723,10 +723,9 @@ static void validate_mcu_fw_version(struct hid_device = *hdev, int idProduct) =20 static bool asus_has_report_id(struct hid_device *hdev, u16 report_id) { - int t, f, u, err =3D 0; struct hid_report *report; =20 - for (t =3D HID_INPUT_REPORT; t <=3D HID_FEATURE_REPORT; t++) { + for (int t =3D HID_INPUT_REPORT; t <=3D HID_FEATURE_REPORT; t++) { list_for_each_entry(report, &hdev->report_enum[t].report_list, list) { if (report->id =3D=3D report_id) return true; --=20 2.53.0 From nobody Sat Apr 18 09:30:45 2026 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E75943DA3D for ; Sat, 28 Feb 2026 14:46:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289998; cv=none; b=kn0CrtwoSf8X5Gcgf3QxEuOYBko++kWCoJ1UD3jWypxEiptswM/6NOBX3f7nNE7EVyiiY2IxfTe4DYGgxjzam7cavUDiUt835cilewAjKFEWfK8g24J93UzLIFUBq/ZF4dzWEZ+ciBAt9oBk1IMJCh8yNgXwmYhaaonBbm22KpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289998; c=relaxed/simple; bh=RLfUS5tra/gyyd3lDFT3Jo+sr3I3Gar7nGUgIP4tNNs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=auPYDYCNQnjzuDHkxZXzXL7zBOuOWZAOCoDaVz4WqUxWYidDHf65kau8GXrUA0b6cIBBgVoYSol9Qb4M2i0uknhZQEqifJNxvaxa5wbd2XOkJSy/a/LG/wQRydtwS6YJOTkKMSTB/L+lI2biSIGbvg15YWo2yoBCtwTqFltfVvY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Zq8UnDVU; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Zq8UnDVU" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772289995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0/JjveZr9Jn4MeDPTXiAb+xofPvVBJSGHbnUYefB24Q=; b=Zq8UnDVUZL8QHqk0ADiv2zMgtjWxyM9uORb1l9uMbFWpFmNdfaV24YX8SbRTSNPZHjx0IU UgkmYxEU6F4a1xAOojbrFDxweg9Aq07dZT3+4GTwBqtM8l0sKLKki8G7ukdlvg6BC+HDXf V1ecYxw3AMklXdYwEURn5l94QeiRaOM= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH 4/7] HID: asus: make asus_resume adhere to linux kernel coding standards Date: Sat, 28 Feb 2026 15:46:23 +0100 Message-ID: <20260228144626.1661530-5-denis.benato@linux.dev> In-Reply-To: <20260228144626.1661530-1-denis.benato@linux.dev> References: <20260228144626.1661530-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Linux kernel coding standars requires functions opening brackets to be in a newline: move the opening bracket of asus_resume in its own line. Fixes: 546edbd26cff ("HID: hid-asus: reset the backlight brightness level o= n resume") Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 2b4411399571..48731b48523d 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1171,7 +1171,8 @@ static int asus_start_multitouch(struct hid_device *h= dev) return 0; } =20 -static int __maybe_unused asus_resume(struct hid_device *hdev) { +static int __maybe_unused asus_resume(struct hid_device *hdev) +{ struct asus_drvdata *drvdata =3D hid_get_drvdata(hdev); int ret =3D 0; =20 --=20 2.53.0 From nobody Sat Apr 18 09:30:45 2026 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A904743D50E for ; Sat, 28 Feb 2026 14:46:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289999; cv=none; b=JntITUEDIXCgO2mW3GKaDdJTLgjiuLMHCepN93IcRjhsIRc/bg3MXHswJtOGjc5XL/pqmfEf2vNbHc+SWU792vqCc90Ha0VlvCqDDdSc9x6bW+1b1f0m9c1BIr3/y5raUzFDYFNdsdRngXuEq3GxCSDh5YBa3lYBw6e+yLEe4zQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772289999; c=relaxed/simple; bh=ZYyhJQkdtnd8QDPUZ1anLzQIQsKr2hta6/LxIh0+qI4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LRNQdyta6IYeAUeq1LmD3yTE6U17LxzvwSymvBjauLZVTmuGC32jwfWjXzjtzidpHM2yflseSl9Os/IwvUX8pgJvSfR35b8YL9jn/P/2flwUxc2G8RM7UFCs2atyY3d60Y9s1QEI34D/hdInx0upaa5L4DLnemHJyPkuvO96fbE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=FNZCX320; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="FNZCX320" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772289996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=06tPI1zyP9R/VLmH+jF1xBpu3FdDn3mEhwsITAJzEjQ=; b=FNZCX320OMDjyz3iUL8GutbeMfTYSRZgA8PvnSnXWB6rMM5/3ji+UIEl48mduoz+bzLSUE g1vR4y5QYtCOXmvyATmZ8D0MimCWd+lhwK411A0nGFD3WIyfIBc9wBPj77WUdiBNDluOjS PLOhw+UiALLBapLERrllp//YTDHNfQU= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH 5/7] HID: asus: simplify and improve asus_kbd_set_report() Date: Sat, 28 Feb 2026 15:46:24 +0100 Message-ID: <20260228144626.1661530-6-denis.benato@linux.dev> In-Reply-To: <20260228144626.1661530-1-denis.benato@linux.dev> References: <20260228144626.1661530-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Make the function shorter and easier to read using __free, and also fix a misaligned comment closing tag. The __free macro from cleanup.h is already used in the driver, but its include is missing: add it. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 48731b48523d..61705fd10d90 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -21,6 +21,7 @@ */ =20 #include +#include #include #include #include @@ -464,23 +465,18 @@ static int asus_raw_event(struct hid_device *hdev, =20 static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, siz= e_t buf_size) { - unsigned char *dmabuf; int ret; =20 - dmabuf =3D kmemdup(buf, buf_size, GFP_KERNEL); + u8 *dmabuf __free(kfree) =3D kmemdup(buf, buf_size, GFP_KERNEL); if (!dmabuf) return -ENOMEM; =20 /* * The report ID should be set from the incoming buffer due to LED and key * interfaces having different pages - */ - ret =3D hid_hw_raw_request(hdev, buf[0], dmabuf, - buf_size, HID_FEATURE_REPORT, - HID_REQ_SET_REPORT); - kfree(dmabuf); - - return ret; + */ + return hid_hw_raw_request(hdev, buf[0], dmabuf, buf_size, HID_FEATURE_REP= ORT, + HID_REQ_SET_REPORT); } =20 static int asus_kbd_init(struct hid_device *hdev, u8 report_id) --=20 2.53.0 From nobody Sat Apr 18 09:30:45 2026 Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81EB643E499 for ; Sat, 28 Feb 2026 14:46:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772290003; cv=none; b=ryDqpqa2OTHgfM3GsqL2afdU0DotEEwVctLw9XJu8WIXFgI4gvhtRjK8MtDE1sVEWF5ukD8kDPAj3qldYchR7tmt7wdvAbmC0lEDUwYBa43yaqfxVR53QnIStvxgL/soraAkUgT1/efKxo+o/wBXF9zi9j6xFBp6Pi2a4HCVQ84= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772290003; c=relaxed/simple; bh=zSxrtZZVnECdu9m8Fhscwp54sVyOqciVxbgbZAjevWg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rtej+4k3Rfbg+lsXUBlrfK/N6qIYFTzR+VLizgqssuwNk6gN/oFjm2hHLm8FM3GBQK2qFdVDj3Jd6lHjcIneyeA7L2JEKIFHwWgmDxdtGNrlyF/l0PITEszn6ZVF++KhgUEE2ndyVULD8se/4x7BYq4Z81dzgZoWNfP8Qv9+edk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=To/15Jnq; arc=none smtp.client-ip=91.218.175.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="To/15Jnq" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772289997; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LOz2UtYPv9SlPIqkVTbqHfsvk2QfC9T+n6BQrawVBRo=; b=To/15JnqgjK41LY9VAvL9XXMEBIHtwKX6YGQIUXmGJjASjwGnclXPXRJPJTGkCoJPsjxq4 U+euHfuvt1MO9vsvcMATNBlkrgGIWwNqtPGS5mGir+CF4U3q2XT2/W7CnVRGpPWruAyk5Q nRXll6cagUaAfRNOpl9pnrOzNS5a2+A= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH 6/7] HID: asus: do not abort probe when not necessary Date: Sat, 28 Feb 2026 15:46:25 +0100 Message-ID: <20260228144626.1661530-7-denis.benato@linux.dev> In-Reply-To: <20260228144626.1661530-1-denis.benato@linux.dev> References: <20260228144626.1661530-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" In order to avoid dereferencing a NULL pointer asus_probe is aborted early and control of some asus devices is transferred over hid-generic after erroring out even when such NULL dereference cannot happen: only early abort when the NULL dereference can happen. Also make the code shorter and more adherent to coding standards removing square brackets enclosing single-line if-else statements. Fixes: d3af6ca9a8c3 ("HID: asus: fix UAF via HID_CLAIMED_INPUT validation") Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 61705fd10d90..bcf3b0c7c758 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1325,22 +1325,17 @@ static int asus_probe(struct hid_device *hdev, cons= t struct hid_device_id *id) * were freed during registration due to no usages being mapped, * leaving drvdata->input pointing to freed memory. */ - if (!drvdata->input || !(hdev->claimed & HID_CLAIMED_INPUT)) { - hid_err(hdev, "Asus input not registered\n"); - ret =3D -ENOMEM; - goto err_stop_hw; - } - - if (drvdata->tp) { - drvdata->input->name =3D "Asus TouchPad"; - } else { - drvdata->input->name =3D "Asus Keyboard"; - } + if (drvdata->input && (hdev->claimed & HID_CLAIMED_INPUT)) { + if (drvdata->tp) + drvdata->input->name =3D "Asus TouchPad"; + else + drvdata->input->name =3D "Asus Keyboard"; =20 - if (drvdata->tp) { - ret =3D asus_start_multitouch(hdev); - if (ret) - goto err_stop_hw; + if (drvdata->tp) { + ret =3D asus_start_multitouch(hdev); + if (ret) + goto err_stop_hw; + } } =20 return 0; --=20 2.53.0 From nobody Sat Apr 18 09:30:45 2026 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C44743CEDC for ; Sat, 28 Feb 2026 14:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772290003; cv=none; b=UXP/V21TiwUIozE++w3WEuDqmwe63x++VThJhnCvBbrm46P4d13aA5VCg8eo9oc5Olr4EpvkKmN+7NUxihKc0RLv4cyCQ2pC0I8aauUI40oNzt8QSBfNVWaobMxJ1d+ya01ayEO6/WuoiYxs0FKx6u2z8AuIgozJLrJHpvf2ggc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772290003; c=relaxed/simple; bh=LqPaTLW5AI75ZNkQD/QdAcSIUZ/1Ek73aCVguRLEBCE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qm1Fth5B7fwoW0kCQ8DfKYCC4C/nCwT3pufQC+myC8h0CLrqdvBqFDtAG9u6lwgsFhADYT1DA4i7ex8/3kdXsdagW/pTfQB7i1Voj43GOcbS6ckdY7iuCDGGCEc7ipic4HZtuhNxGK78O2ELTou7MM9dPnijdUutTTfWsdpRBGA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=BMvz77VT; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="BMvz77VT" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772289997; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=itnmQQEA5TtzfBKuC42LtASy2zNtasPxJdWo4/puqdg=; b=BMvz77VTZ6tGQca8Xc2Zk7LDoiPFcp/jeyaLZqUSGvB77pko4fiRFKjIOIN1KT/zAsSP3f xcl/KkIFd/fubZG8u9EkivPoz/G0J73jYBUpcA/6oM2ltz0nhKld94jP2kyljxk3Do80iK k/HCiYILDxLtliyAl2hGq9Tz8ohSkLY= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH 7/7] HID: asus: do not try to initialize the backlight if the enpoint doesn't support it Date: Sat, 28 Feb 2026 15:46:26 +0100 Message-ID: <20260228144626.1661530-8-denis.benato@linux.dev> In-Reply-To: <20260228144626.1661530-1-denis.benato@linux.dev> References: <20260228144626.1661530-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Avoid possibly printing a warning about the inability to initialize the backlight if the hid endpoint doesn't support it. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index bcf3b0c7c758..6e9a3a3d5616 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1309,7 +1309,8 @@ static int asus_probe(struct hid_device *hdev, const = struct hid_device_id *id) } =20 if (is_vendor && (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) && - asus_kbd_register_leds(hdev)) + (asus_has_report_id(hdev, FEATURE_KBD_REPORT_ID)) && + (asus_kbd_register_leds(hdev))) hid_warn(hdev, "Failed to initialize backlight.\n"); =20 /* --=20 2.53.0