Subject: [PATCH 1/3] spi: rb4xx: null pointer bug fix
From: Christopher Hill <[email-masked]>
To: Mark Brown <[email-masked]>
Cc: Christopher Hill <[email-masked]>, [email-masked], [email-masked]
Date: Thu, 21 May 2020 14:36:29 -0400
List-Id: <linux-spi.vger.kernel.org>

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-masked]>
---
 drivers/spi/spi-rb4xx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/spi/spi-rb4xx.c
+++ b/drivers/spi/spi-rb4xx.c
@@ -158,6 +158,11 @@ static int rb4xx_spi_probe(struct platfo
 	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");
@@ -168,11 +173,6 @@ static int rb4xx_spi_probe(struct platfo
 	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);