spi: Always check complete callback before calling it

Since commit 1e25cd4729 "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>
This commit is contained in:
Axel Lin
2014-04-02 22:21:04 +08:00
committed by Mark Brown
parent 455c6fdbd2
commit 0a6d38795a
7 changed files with 18 additions and 9 deletions

View File

@@ -265,7 +265,8 @@ static void txx9spi_work_one(struct txx9spi *c, struct spi_message *m)
exit:
m->status = status;
m->complete(m->context);
if (m->complete)
m->complete(m->context);
/* normally deactivate chipselect ... unless no error and
* cs_change has hinted that the next message will probably