mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] commands: spi: fix NULL pointer dereference
@ 2019-05-16  9:18 Steffen Trumtrar
  2019-05-17  7:34 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Steffen Trumtrar @ 2019-05-16  9:18 UTC (permalink / raw)
  To: Barebox List

The renaming of "master" to "controller" done in
    812a9ddcdf211302a050cf8f61f7af577bc29a23
    spi: Generalize SPI "master" to "controller"

breaks the spi command, because the spi.master pointer is not assigned.
The pointer is kept for backwards compatability.

Assign it, so that spi drivers that are still using "spi->master" can be
used.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 commands/spi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/commands/spi.c b/commands/spi.c
index 55a0e255af17..d35aa1cd81c9 100644
--- a/commands/spi.c
+++ b/commands/spi.c
@@ -67,6 +67,7 @@ static int do_spi(int argc, char *argv[])
 		printf("spi bus %d not found\n", bus);
 		return -ENODEV;
 	}
+	spi.master = spi.controller;
 
 	if (spi.chip_select >= spi.controller->num_chipselect) {
 		printf("spi chip select (%d) >= controller num chipselect (%d)\n",
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2019-05-17  7:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16  9:18 [PATCH] commands: spi: fix NULL pointer dereference Steffen Trumtrar
2019-05-17  7:34 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox