Skip to content

Commit 678e5e1

Browse files
ch6574broonie
authored andcommitted
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: Christopher Hill <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 05897c7 commit 678e5e1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/spi/spi-rb4xx.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,11 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
158158
master->transfer_one = rb4xx_transfer_one;
159159
master->set_cs = rb4xx_set_cs;
160160

161+
rbspi = spi_master_get_devdata(master);
162+
rbspi->base = spi_base;
163+
rbspi->clk = ahb_clk;
164+
platform_set_drvdata(pdev, rbspi);
165+
161166
err = devm_spi_register_master(&pdev->dev, master);
162167
if (err) {
163168
dev_err(&pdev->dev, "failed to register SPI master\n");
@@ -168,11 +173,6 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
168173
if (err)
169174
return err;
170175

171-
rbspi = spi_master_get_devdata(master);
172-
rbspi->base = spi_base;
173-
rbspi->clk = ahb_clk;
174-
platform_set_drvdata(pdev, rbspi);
175-
176176
/* Enable SPI */
177177
rb4xx_write(rbspi, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO);
178178

0 commit comments

Comments
 (0)