[PATCH v1 2/2] gpio: sloppy-logic-analyzer: Check for error code from devm_mutex_init() call

Andy Shevchenko posted 2 patches 3 weeks, 4 days ago
There is a newer version of this series
[PATCH v1 2/2] gpio: sloppy-logic-analyzer: Check for error code from devm_mutex_init() call
Posted by Andy Shevchenko 3 weeks, 4 days ago
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: 7828b7bbbf20 ("gpio: add sloppy logic analyzer using polling")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-sloppy-logic-analyzer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-sloppy-logic-analyzer.c b/drivers/gpio/gpio-sloppy-logic-analyzer.c
index 64f2ca4a72b2..8cf3b171c599 100644
--- a/drivers/gpio/gpio-sloppy-logic-analyzer.c
+++ b/drivers/gpio/gpio-sloppy-logic-analyzer.c
@@ -234,7 +234,9 @@ static int gpio_la_poll_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	devm_mutex_init(dev, &priv->blob_lock);
+	ret = devm_mutex_init(dev, &priv->blob_lock);
+	if (ret)
+		return ret;
 
 	fops_buf_size_set(priv, GPIO_LA_DEFAULT_BUF_SIZE);
 
-- 
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v1 2/2] gpio: sloppy-logic-analyzer: Check for error code from devm_mutex_init() call
Posted by Wolfram Sang 3 weeks, 4 days ago
On Wed, Oct 30, 2024 at 05:30:27PM +0200, Andy Shevchenko wrote:
> 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: 7828b7bbbf20 ("gpio: add sloppy logic analyzer using polling")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks!