summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Trumtrar <s.trumtrar@pengutronix.de>2019-05-16 11:18:39 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-05-17 09:34:15 +0200
commit4b9696e5a103ee615afe8ef320d7c06d4dfcaf88 (patch)
tree5954f6b29411609667c590c84c92b3f77c7d0665
parente6a025abdd2fcd60962d8f6a1f52048e52e35c78 (diff)
downloadbarebox-4b9696e5a103ee615afe8ef320d7c06d4dfcaf88.tar.gz
commands: spi: fix NULL pointer dereference
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> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--commands/spi.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/commands/spi.c b/commands/spi.c
index 55a0e25..d35aa1c 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",