diff mbox

spi: dw-pci: fix bug when regs left uninitialized

Message ID 1409145672-10258-1-git-send-email-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Commit c9d5d6fe168fd45a4dfdd0116affe708789b4702
Headers show

Commit Message

Andy Shevchenko Aug. 27, 2014, 1:21 p.m. UTC
The commit 04f421e7 "spi: dw: use managed resources" changes drivers to use
managed functions, but seems wasn't properly tested in PCI case. The regs field
of struct dw_spi left uninitialized. Thus, kernel crashes when tries to access
to the SPI controller registers. This patch fixes the issue.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: <stable@vger.kernel.org> # v3.14+
---
 drivers/spi/spi-dw-pci.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mark Brown Aug. 27, 2014, 2:46 p.m. UTC | #1
On Wed, Aug 27, 2014 at 04:21:12PM +0300, Andy Shevchenko wrote:
> The commit 04f421e7 "spi: dw: use managed resources" changes drivers to use
> managed functions, but seems wasn't properly tested in PCI case. The regs field
> of struct dw_spi left uninitialized. Thus, kernel crashes when tries to access
> to the SPI controller registers. This patch fixes the issue.

Applied.  Please use the Fixes: tag and use a minimum of 12 characters
for the commit ID (to avoid collisions).
Andy Shevchenko Aug. 27, 2014, 2:53 p.m. UTC | #2
On Wed, 2014-08-27 at 15:46 +0100, Mark Brown wrote:
> On Wed, Aug 27, 2014 at 04:21:12PM +0300, Andy Shevchenko wrote:
> > The commit 04f421e7 "spi: dw: use managed resources" changes drivers to use
> > managed functions, but seems wasn't properly tested in PCI case. The regs field
> > of struct dw_spi left uninitialized. Thus, kernel crashes when tries to access
> > to the SPI controller registers. This patch fixes the issue.
> 
> Applied.  Please use the Fixes: tag and use a minimum of 12 characters
> for the commit ID (to avoid collisions).

Noted, thank you!
diff mbox

Patch

diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c
index e203d8f..473bd52 100644
--- a/drivers/spi/spi-dw-pci.c
+++ b/drivers/spi/spi-dw-pci.c
@@ -59,6 +59,8 @@  static int spi_pci_probe(struct pci_dev *pdev,
 	if (ret)
 		return ret;
 
+	dws->regs = pcim_iomap_table(pdev)[pci_bar];
+
 	dws->bus_num = 0;
 	dws->num_cs = 4;
 	dws->irq = pdev->irq;