Skip to contentSkip to conversation

platform/x86: thinkpad_acpi: check the return value of devm_mutex_init()

PATCH In review Bartosz Golaszewski 2 participants 2 messages Mar 5, 2025 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: thinkpad_acpi: check the return value of devm_mutex_init()

From: Bartosz Golaszewski <[email protected]>

devm_mutex_init() can fail so check its return value.

Fixes 38b9ab80db31 ("platform/x86: thinkpad_acpi: Move subdriver initialization to tpacpi_pdriver's probe.")
---
 drivers/platform/x86/thinkpad_acpi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +3 -1
index 6128ad820ea0..d8df1405edfa 100644
@@ -11849,7 +11849,9 @@ static int __init tpacpi_pdriver_probe(struct platform_device *pdev)
 {
 	int ret;
 
-	devm_mutex_init(&pdev->dev, &tpacpi_inputdev_send_mutex);
+	ret = devm_mutex_init(&pdev->dev, &tpacpi_inputdev_send_mutex);
+	if (ret)
+		return ret;
 
 	tpacpi_inputdev = devm_input_allocate_device(&pdev->dev);
 	if (!tpacpi_inputdev)
Signature · 1 line
2.45.2
maintainer
#1 lore raw
Quoted 3 lines · Bartosz Golaszewski

devm_mutex_init() can fail so check its return value.

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.

The list of commits applied:
[1/1] platform/x86: thinkpad_acpi: check the return value of devm_mutex_init()

      commit: e57eabe2fb044950e6ffdfe01803895043dec0b7

--
i.