Skip to contentSkip to conversation

platform/x86: thinkpad_acpi: Fix USB-C Security probe failure on unsupported platforms

PATCH In review Vishnu Sankar 2 participants 3 messages Jul 15 – Jul 21

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 platform/x86: thinkpad_acpi: Fix USB-C Security probe failure on unsupported platforms

On systems where the USCS ACPI method is absent, acpi_evalf() returns AE_NOT_FOUND which maps to -EIO. This caused tpacpi_usbc_security_init() to propagate the error and thinkpad_acpi failed to probe entirely on unsupported platforms.

Fix this by checking for USCS method presence with acpi_has_method() before attempting to call it, returning -ENODEV immediately if absent. This follows the same pattern used by other subdrivers in thinkpad_acpi.c.

Fixes 67e8d1e9cacd ("platform/x86: thinkpad_acpi: Add USB-C Security (USCS) support")

---
Changes since v1:
- Fix incorrect email address for Oliver Lin
- Add Tested-by from Oliver Lin confirming fix works on ThinkPad P15 Gen 1 and ThinkPad P50s

---
 drivers/platform/x86/lenovo/thinkpad_acpi.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/platform/x86/lenovo/thinkpad_acpi.c +3 -0
index 91db4c8eeac2..85ed506516f0 100644
@@ -11368,6 +11368,9 @@ static int tpacpi_usbc_security_init(struct ibm_init_struct *iibm)
 {
 	int err;
 
+	if (!acpi_has_method(hkey_handle, "USCS"))
+		return -ENODEV;
+
 	err = usbc_security_query(&tp_features.usbc_security_enabled);
 	if (err == -ENODEV)
 		return 0;
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 10 lines · Vishnu Sankar

On systems where the USCS ACPI method is absent, acpi_evalf() returns AE_NOT_FOUND which maps to -EIO. This caused tpacpi_usbc_security_init() to propagate the error and thinkpad_acpi failed to probe entirely on unsupported platforms.

Fix this by checking for USCS method presence with acpi_has_method() before attempting to call it, returning -ENODEV immediately if absent. This follows the same pattern used by other subdrivers in thinkpad_acpi.c.

[...]

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent cycle or is clearly a regression fix.

The list of commits applied:
[1/1] platform/x86: thinkpad_acpi: Fix USB-C Security probe failure on unsupported platforms

      commit: 10bae492e814eeb1013ab9bc08f655d14fca46e4

--
i.

#2 lore raw

Hi Ilpo,

Thank you so much.

Quoted 31 lines · Ilpo Järvinen
Quoted 10 lines · Vishnu Sankar

On systems where the USCS ACPI method is absent, acpi_evalf() returns AE_NOT_FOUND which maps to -EIO. This caused tpacpi_usbc_security_init() to propagate the error and thinkpad_acpi failed to probe entirely on unsupported platforms.

Fix this by checking for USCS method presence with acpi_has_method() before attempting to call it, returning -ENODEV immediately if absent. This follows the same pattern used by other subdrivers in thinkpad_acpi.c.

[...]

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent cycle or is clearly a regression fix.

The list of commits applied:
[1/1] platform/x86: thinkpad_acpi: Fix USB-C Security probe failure on unsupported platforms

      commit: 10bae492e814eeb1013ab9bc08f655d14fca46e4

--
i.

Signature · 3 lines
Regards,

      Vishnu Sankar