summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-sh.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-04-02 18:21:04 +0400
committerMark Brown <broonie@linaro.org>2014-04-03 14:13:38 +0400
commit0a6d38795a405c49ea0012f04173613382def58c (patch)
tree41cca48cd41bdf3c9034b8f59ff5f4079f9bdaf2 /drivers/spi/spi-sh.c
parent455c6fdbd219161bd09b1165f11699d6d73de11c (diff)
downloadlinux-0a6d38795a405c49ea0012f04173613382def58c.tar.xz
spi: Always check complete callback before calling it
Since commit 1e25cd4729bd "spi: Do not require a completion", this checking is required to prevent NULL pointer dereference. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-sh.c')
-rw-r--r--drivers/spi/spi-sh.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c
index f6f2c7010177..03edf5ed0e9f 100644
--- a/drivers/spi/spi-sh.c
+++ b/drivers/spi/spi-sh.c
@@ -322,7 +322,8 @@ static void spi_sh_work(struct work_struct *work)
spin_lock_irqsave(&ss->lock, flags);
mesg->status = 0;
- mesg->complete(mesg->context);
+ if (mesg->complete)
+ mesg->complete(mesg->context);
}
clear_fifo(ss);
@@ -340,7 +341,8 @@ static void spi_sh_work(struct work_struct *work)
error:
mesg->status = ret;
- mesg->complete(mesg->context);
+ if (mesg->complete)
+ mesg->complete(mesg->context);
spi_sh_clear_bit(ss, SPI_SH_SSA | SPI_SH_SSDB | SPI_SH_SSD,
SPI_SH_CR1);