spi: fix return value check in bcm2835_spi_probe()
authorYuanjun Gong <ruc_gongyuanjun@163.com>
Thu, 20 Jul 2023 14:08:59 +0000 (22:08 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 20 Jul 2023 14:29:10 +0000 (15:29 +0100)
in bcm2835_spi_probe(), clk_prepare_enable() may fail, therefore,
the return value of clk_prepare_enable() should be checked, and
the function should return error if clk_prepare_enable() fails.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
Link: https://lore.kernel.org/r/20230720140859.33883-1-ruc_gongyuanjun@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-bcm2835.c

index b247ee8..83fd062 100644 (file)
@@ -1363,7 +1363,9 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
        if (bs->irq <= 0)
                return bs->irq ? bs->irq : -ENODEV;
 
-       clk_prepare_enable(bs->clk);
+       err = clk_prepare_enable(bs->clk);
+       if (err)
+               return err;
        bs->clk_hz = clk_get_rate(bs->clk);
 
        err = bcm2835_dma_init(ctlr, &pdev->dev, bs);