Skip to content

Commit

Permalink
spi: rb4xx: null pointer bug fix
Browse files Browse the repository at this point in the history
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: Christopher Hill <ch6574@gmail.com>
Link: https://lore.kernel.org/r/20200521183631.37806-1-ch6574@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Christopher Hill authored and Mark Brown committed May 22, 2020
1 parent 05897c7 commit 678e5e1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/spi/spi-rb4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
master->transfer_one = rb4xx_transfer_one;
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);
if (err) {
dev_err(&pdev->dev, "failed to register SPI master\n");
Expand All @@ -168,11 +173,6 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
if (err)
return err;

rbspi = spi_master_get_devdata(master);
rbspi->base = spi_base;
rbspi->clk = ahb_clk;
platform_set_drvdata(pdev, rbspi);

/* Enable SPI */
rb4xx_write(rbspi, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO);

Expand Down

0 comments on commit 678e5e1

Please sign in to comment.