From: Christopher Hill <ch6574@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Christopher Hill <ch6574@gmail.com>,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] spi: rb4xx: null pointer bug fix
Date: Thu, 21 May 2020 14:36:29 -0400 [thread overview]
Message-ID: <20200521183631.37806-1-ch6574@gmail.com> (raw)
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>
---
drivers/spi/spi-rb4xx.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
index 4c9620e0d18c..17e1a77dc132 100644
--- a/drivers/spi/spi-rb4xx.c
+++ b/drivers/spi/spi-rb4xx.c
@@ -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");
@@ -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);
--
2.25.1
next reply other threads:[~2020-05-21 18:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-21 18:36 Christopher Hill [this message]
2020-05-21 18:36 ` [PATCH 2/3] spi: rb4xx: update driver to be device tree aware Christopher Hill
2020-05-21 18:36 ` [PATCH 3/3] spi: rb4xx: add corresponding device tree documentation Christopher Hill
2020-05-22 19:00 ` [PATCH 1/3] spi: rb4xx: null pointer bug fix Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200521183631.37806-1-ch6574@gmail.com \
--to=ch6574@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).