[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230227030913.893004-2-void0red@gmail.com>
Date: Mon, 27 Feb 2023 11:09:13 +0800
From: void0red <void0red@...il.com>
To: linux@...ck-us.net
Cc: jdelvare@...e.com, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org, mezin.alexander@...il.com,
void0red@...il.com
Subject: [PATCH v2 2/2] hwmon: nzxt-smart2: add a check of devm_add_action in nzxt_smart2_hid_probe
From: Kang Chen <void0red@...il.com>
devm_add_action may fails, check it and return early.
Signed-off-by: Kang Chen <void0red@...il.com>
---
v2 -> v1: split the patch
drivers/hwmon/nzxt-smart2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/nzxt-smart2.c b/drivers/hwmon/nzxt-smart2.c
index 2b93ba896..725974cb3 100644
--- a/drivers/hwmon/nzxt-smart2.c
+++ b/drivers/hwmon/nzxt-smart2.c
@@ -737,8 +737,10 @@ static int nzxt_smart2_hid_probe(struct hid_device *hdev,
init_waitqueue_head(&drvdata->wq);
mutex_init(&drvdata->mutex);
- devm_add_action(&hdev->dev, (void (*)(void *))mutex_destroy,
+ ret = devm_add_action(&hdev->dev, (void (*)(void *))mutex_destroy,
&drvdata->mutex);
+ if (ret)
+ return ret;
ret = hid_parse(hdev);
if (ret)
--
2.34.1
Powered by blists - more mailing lists