linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi-altera: Fix NULL pointer dereference in spi_bitbang_transfer_one
@ 2014-12-03 11:25 Iain Baron
       [not found] ` <1417605949-11447-1-git-send-email-iain.baron-YmHWzhjmega9Zq0HfjR8jw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Iain Baron @ 2014-12-03 11:25 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Iain Baron

spi-altera.c is missing a bitbang setup_transfer callback to setup
the clock and wordsize for the SPI transfer.  This triggers a NULL
pointer dereference in spi_bitbang_transfer_one.
Provide the missing callback, which simply returns success, because
the parameters are not configurable at runtime for this hardware.

Signed-off-by: Iain Baron <iain.baron-YmHWzhjmega9Zq0HfjR8jw@public.gmane.org>
---
 drivers/spi/spi-altera.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index 595b62c..6b63f60 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -198,6 +198,12 @@ static irqreturn_t altera_spi_irq(int irq, void *dev)
 	return IRQ_HANDLED;
 }
 
+static int altera_spi_setup_transfer(struct spi_device *spi,
+				struct spi_transfer *t)
+{
+	return 0;
+}
+
 static int altera_spi_probe(struct platform_device *pdev)
 {
 	struct altera_spi_platform_data *platp = dev_get_platdata(&pdev->dev);
@@ -224,6 +230,7 @@ static int altera_spi_probe(struct platform_device *pdev)
 		return err;
 	hw->bitbang.chipselect = altera_spi_chipsel;
 	hw->bitbang.txrx_bufs = altera_spi_txrx;
+	hw->bitbang.setup_transfer = altera_spi_setup_transfer;
 
 	/* find and map our resources */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-03 15:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-03 11:25 [PATCH] spi-altera: Fix NULL pointer dereference in spi_bitbang_transfer_one Iain Baron
     [not found] ` <1417605949-11447-1-git-send-email-iain.baron-YmHWzhjmega9Zq0HfjR8jw@public.gmane.org>
2014-12-03 13:03   ` Mark Brown
     [not found]     ` <20141203130324.GY7712-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-12-03 15:16       ` Iain Baron
     [not found]         ` <6438CE2D8332724FAD5D85EF6ED23E1912952563-ERkBUouPzqe8yxLPduiYWyEMcTpanLKPuOMsETyM3/Q@public.gmane.org>
2014-12-03 15:54           ` Mark Brown

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).