[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4afa457713874729eb61eec533a4674a51d1d242.1739985599.git.christophe.jaillet@wanadoo.fr>
Date: Wed, 19 Feb 2025 18:20:20 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Lee Jones <lee@...nel.org>,
Pavel Machek <pavel@...nel.org>,
Vicentiu Galanopulo <vicentiu.galanopulo@...ote-tech.co.uk>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-leds@...r.kernel.org
Subject: [PATCH] leds: st1202: Fix an error handling path in st1202_probe()
devm_mutex_init() may return -ENOMEM.
So this error should be handled in st1202_probe().
Fixes: 259230378c65 ("leds: Add LED1202 I2C driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
drivers/leds/leds-st1202.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c
index b691c4886993..4fc17d518292 100644
--- a/drivers/leds/leds-st1202.c
+++ b/drivers/leds/leds-st1202.c
@@ -356,7 +356,10 @@ 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