[U-Boot] [PATCH] spi: spi-mem: Check if exec_op function is set before calling it

Add check if exec_op is set before calling it. At the moment it is called unconditionally, which leads to a crash if it is not set correctly.
Signed-off-by: Bernhard Messerklinger bernhard.messerklinger@br-automation.com ---
drivers/spi/spi-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index 1bb0987edb..b86eee75bc 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -214,7 +214,7 @@ int spi_mem_exec_op(struct spi_slave *slave, const struct spi_mem_op *op) if (ret < 0) return ret;
- if (ops->mem_ops) { + if (ops->mem_ops && ops->mem_ops->exec_op) { #ifndef __UBOOT__ /* * Flush the message queue before executing our SPI memory

On Tue, Mar 26, 2019 at 5:01 PM Bernhard Messerklinger bernhard.messerklinger@br-automation.com wrote:
Add check if exec_op is set before calling it. At the moment it is called unconditionally, which leads to a crash if it is not set correctly.
Signed-off-by: Bernhard Messerklinger bernhard.messerklinger@br-automation.com
drivers/spi/spi-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On Tue, Mar 26, 2019 at 2:31 PM Bernhard Messerklinger bernhard.messerklinger@br-automation.com wrote:
Add check if exec_op is set before calling it. At the moment it is called unconditionally, which leads to a crash if it is not set correctly.
Signed-off-by: Bernhard Messerklinger bernhard.messerklinger@br-automation.com
Applied to u-boot-spi/master
participants (3)
-
Bernhard Messerklinger
-
Bin Meng
-
Jagan Teki