summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2015-04-07 20:39:19 +0200
committerMark Brown <broonie@kernel.org>2015-04-07 19:41:32 +0100
commitff61eb422024a4614f898c1c73625e222b219a5d (patch)
treeccb5274cf076e8b0473c7dfa2408da63b51ec5c4 /drivers/spi
parentb716c4ffc6a2b0bfbcf9619880f335be11b65708 (diff)
downloadop-kernel-dev-ff61eb422024a4614f898c1c73625e222b219a5d.zip
op-kernel-dev-ff61eb422024a4614f898c1c73625e222b219a5d.tar.gz
spi: Make master->handle_err() callback optional to avoid crashes
If a driver doesn't implement the master->handle_err() callback and an SPI transfer fails, the kernel will crash with a NULL pointer dereference: Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c0003000 [00000000] *pgd=80000040004003, *pmd=00000000 Internal error: Oops: 80000206 [#1] SMP ARM Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.0.0-rc7-koelsch-05861-g1fc9fdd4add4f783 #1046 Hardware name: Generic R8A7791 (Flattened Device Tree) task: eec359c0 ti: eec54000 task.ti: eec54000 PC is at 0x0 LR is at spi_transfer_one_message+0x1cc/0x1f0 Make the master->handle_err() callback optional to avoid the crash. Also fix a spelling mistake in the callback documentation while we're at it. Fixes: b716c4ffc6a2b0bf ("spi: introduce master->handle_err() callback") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 31d4d9d..7713253 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -851,7 +851,7 @@ out:
if (msg->status == -EINPROGRESS)
msg->status = ret;
- if (msg->status)
+ if (msg->status && master->handle_err)
master->handle_err(master, msg);
spi_finalize_current_message(master);
OpenPOWER on IntegriCloud