spi: soft_spi: Fix data abort if slave is not probed
authorChristophe Kerello <christophe.kerello@st.com>
Fri, 2 Aug 2019 13:46:29 +0000 (15:46 +0200)
committerJagan Teki <jagan@amarulasolutions.com>
Mon, 16 Sep 2019 02:39:22 +0000 (08:09 +0530)
commitdfe72d081d4eda0c0788dc5db69de3abbec1b857
tree0b73466d5be7db114ce20dc51dccfc7c1020b84b
parent07a5cb9d3b9bf9bca9ca207b82f92eac73cbdda8
spi: soft_spi: Fix data abort if slave is not probed

In case spi_get_bus_and_cs callback is used, spi bus is first probed
then slave devices are probed. To avoid a data abort in soft_spi probe
function, we need to check that (slave != NULL).

If slave is NULL, cs_flags and clk_flags will be initialized with
respectively GPIOD_ACTIVE_LOW and 0.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
drivers/spi/soft_spi.c