Skip to content

Commit 542cdf4

Browse files
hormsEduardo Valentin
authored andcommitted
thermal: rcar_thermal: avoid NULL dereference in absence of IRQ resources
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: 1969d9d ("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>
1 parent c0c0470 commit 542cdf4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/thermal/rcar_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
598598
enr_bits |= 3 << (i * 8);
599599
}
600600

601-
if (enr_bits)
601+
if (common->base && enr_bits)
602602
rcar_thermal_common_write(common, ENR, enr_bits);
603603

604604
dev_info(dev, "%d sensor probed\n", i);

0 commit comments

Comments
 (0)