aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi/spi-mem.c
diff options
context:
space:
mode:
authorBernhard Messerklinger2019-03-26 10:01:24 +0100
committerJagan Teki2019-04-12 11:17:39 +0530
commit567a3eb7956f98af4ed065499898c6d0ac6443c7 (patch)
tree941cff256e121e275fd256f29a3275536f192690 /drivers/spi/spi-mem.c
parent3f3aef4b9dc88278f31567fe6f26095fd9477b1a (diff)
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> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers/spi/spi-mem.c')
-rw-r--r--drivers/spi/spi-mem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 1bb0987edb7..b86eee75bcb 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