[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250204-must_check-devm_mutex_init-v2-1-7b6271c4b7e6@weissschuh.net>
Date: Tue, 04 Feb 2025 07:52:50 +0100
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>, Pavel Machek <pavel@....cz>,
Lee Jones <lee@...nel.org>,
Vicentiu Galanopulo <vicentiu.galanopulo@...ote-tech.co.uk>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-leds@...r.kernel.org,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH v2 1/2] leds: st1202: Check for error code from
devm_mutex_init() call
Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.
Fixes: 259230378c65 ("leds: Add LED1202 I2C driver")
Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
drivers/leds/leds-st1202.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c
index b691c4886993f3e371e857543863c9a724742f39..657c62cb24fa726622369fc965fa7195e73170f0 100644
--- a/drivers/leds/leds-st1202.c
+++ b/drivers/leds/leds-st1202.c
@@ -356,7 +356,9 @@ static int st1202_probe(struct i2c_client *client)
if (!chip)
return -ENOMEM;
- devm_mutex_init(&client->dev, &chip->lock);
+ ret = devm_mutex_init(&client->dev, &chip->lock);
+ if (ret < 0)
+ return ret;
chip->client = client;
ret = st1202_dt_init(chip);
--
2.48.1
Powered by blists - more mailing lists