Commit 678e5e1e authored by Christopher Hill's avatar Christopher Hill Committed by Mark Brown

spi: rb4xx: null pointer bug fix

This patch fixes a null pointer bug in the spi driver spi-rb4xx.c by
moving the private data initialization to earlier in probe
Signed-off-by: default avatarChristopher Hill <ch6574@gmail.com>
Link: https://lore.kernel.org/r/20200521183631.37806-1-ch6574@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 05897c71
...@@ -158,6 +158,11 @@ static int rb4xx_spi_probe(struct platform_device *pdev) ...@@ -158,6 +158,11 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
master->transfer_one = rb4xx_transfer_one; master->transfer_one = rb4xx_transfer_one;
master->set_cs = rb4xx_set_cs; master->set_cs = rb4xx_set_cs;
rbspi = spi_master_get_devdata(master);
rbspi->base = spi_base;
rbspi->clk = ahb_clk;
platform_set_drvdata(pdev, rbspi);
err = devm_spi_register_master(&pdev->dev, master); err = devm_spi_register_master(&pdev->dev, master);
if (err) { if (err) {
dev_err(&pdev->dev, "failed to register SPI master\n"); dev_err(&pdev->dev, "failed to register SPI master\n");
...@@ -168,11 +173,6 @@ static int rb4xx_spi_probe(struct platform_device *pdev) ...@@ -168,11 +173,6 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
if (err) if (err)
return err; return err;
rbspi = spi_master_get_devdata(master);
rbspi->base = spi_base;
rbspi->clk = ahb_clk;
platform_set_drvdata(pdev, rbspi);
/* Enable SPI */ /* Enable SPI */
rb4xx_write(rbspi, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO); rb4xx_write(rbspi, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment