]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
spi: spi-nxp-fspi: Check return value of devm_mutex_init()
authorThomas Weißschuh <linux@weissschuh.net>
Tue, 17 Jun 2025 17:08:12 +0000 (19:08 +0200)
committerBoqun Feng <boqun.feng@gmail.com>
Fri, 11 Jul 2025 22:02:07 +0000 (15:02 -0700)
devm_mutex_init() can fail. With CONFIG_DEBUG_MUTEXES=y the mutex will
be marked as unusable and trigger errors on usage.

Add the missed check.

Fixes: 48900813abd2 ("spi: spi-nxp-fspi: remove the goto in probe")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20250617-must_check-devm_mutex_init-v7-1-d9e449f4d224@weissschuh.net
drivers/spi/spi-nxp-fspi.c

index e63c77e418231cd0698ffb73eeeebfbe63cc3065..f3d5765054132cd18b7257439ece971f58e9ceb2 100644 (file)
@@ -1273,7 +1273,9 @@ static int nxp_fspi_probe(struct platform_device *pdev)
        if (ret)
                return dev_err_probe(dev, ret, "Failed to request irq\n");
 
-       devm_mutex_init(dev, &f->lock);
+       ret = devm_mutex_init(dev, &f->lock);
+       if (ret)
+               return dev_err_probe(dev, ret, "Failed to initialize lock\n");
 
        ctlr->bus_num = -1;
        ctlr->num_chipselect = NXP_FSPI_MAX_CHIPSELECT;