summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Horman <horms+renesas@verge.net.au>2018-07-24 13:14:13 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-19 22:41:34 +0200
commit8cc36414d8158e68d3bcb56f0ce2396152eac848 (patch)
tree740599da3f821fdbc8f3821f93d8979d4e7f193a
parent273234f22e95efba41e3da408493c58b7a231988 (diff)
downloadlinux-stable-8cc36414d8158e68d3bcb56f0ce2396152eac848.tar.gz
linux-stable-8cc36414d8158e68d3bcb56f0ce2396152eac848.tar.bz2
linux-stable-8cc36414d8158e68d3bcb56f0ce2396152eac848.zip
thermal: rcar_thermal: avoid NULL dereference in absence of IRQ resources
[ Upstream commit 542cdf4068049458e1411b120bd5a4bbe3ddc49a ] Ensure that the base address used by a call to rcar_thermal_common_write() may be NULL if the SOC supports interrupts for use with the thermal device but none are defined in DT as is the case for R-Car H1 (r8a7779). Guard against this condition to prevent a NULL dereference when the device is probed. Tested on: * R-Mobile APE6 (r8a73a4) / APE6EVM * R-Car H1 (r8a7779) / Marzen * R-Car H2 (r8a7790) / Lager * R-Car M2-W (r8a7791) / Koelsch * R-Car M2-N (r8a7793) / Gose * R-Car D3 ES1.0 (r8a77995) / Draak Fixes: 1969d9dc2079 ("thermal: rcar_thermal: add r8a77995 support") Signed-off-by: Simon Horman <horms+renesas@verge.net.au> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/thermal/rcar_thermal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 45fb284d4c11..e77e63070e99 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -598,7 +598,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
enr_bits |= 3 << (i * 8);
}
- if (enr_bits)
+ if (common->base && enr_bits)
rcar_thermal_common_write(common, ENR, enr_bits);
dev_info(dev, "%d sensor probed\n", i);