Skip to content

Commit c640adf

Browse files
t-8chgregkh
authored andcommitted
spi: spi-nxp-fspi: Check return value of devm_mutex_init()
commit d24a54e upstream. 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: 4890081 ("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 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e656ba6 commit c640adf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/spi/spi-nxp-fspi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,9 @@ static int nxp_fspi_probe(struct platform_device *pdev)
12491249
return dev_err_probe(dev, ret, "Failed to request irq\n");
12501250
}
12511251

1252-
devm_mutex_init(dev, &f->lock);
1252+
ret = devm_mutex_init(dev, &f->lock);
1253+
if (ret)
1254+
return dev_err_probe(dev, ret, "Failed to initialize lock\n");
12531255

12541256
ctlr->bus_num = -1;
12551257
ctlr->num_chipselect = NXP_FSPI_MAX_CHIPSELECT;

0 commit comments

Comments
 (0)