diff options
author | Yuanjun Gong <ruc_gongyuanjun@163.com> | 2023-07-20 22:08:59 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-07-20 15:29:10 +0100 |
commit | 1e7dae68510aa90a022fefed392fa794b16bc68b (patch) | |
tree | f35a3f143fdd9333b6e9267dd63731e7b2665025 /drivers/spi/spi-bcm2835.c | |
parent | c5a7b66811d22a4901bd358447e59160dbda8f65 (diff) | |
download | lwn-1e7dae68510aa90a022fefed392fa794b16bc68b.tar.gz lwn-1e7dae68510aa90a022fefed392fa794b16bc68b.zip |
spi: fix return value check in bcm2835_spi_probe()
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>
Diffstat (limited to 'drivers/spi/spi-bcm2835.c')
-rw-r--r-- | drivers/spi/spi-bcm2835.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index b247ee887562..83fd062fc491 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -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); |