]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
thermal: rcar_thermal: Handle probe error gracefully
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tue, 10 Mar 2020 11:47:09 +0000 (12:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 11:17:44 +0000 (13:17 +0200)
[ Upstream commit 39056e8a989ef52486e063e34b4822b341e47b0e ]

If the common register memory resource is not available the driver needs
to fail gracefully to disable PM. Instead of returning the error
directly store it in ret and use the already existing error path.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200310114709.1483860-1-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/rcar_thermal.c

index d0873de718da92189d57b1510a72dac504ef77cf..43f0cd2bd0ae67eec22191372b41d122593b5a47 100644 (file)
@@ -526,8 +526,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
                        res = platform_get_resource(pdev, IORESOURCE_MEM,
                                                    mres++);
                        common->base = devm_ioremap_resource(dev, res);
-                       if (IS_ERR(common->base))
-                               return PTR_ERR(common->base);
+                       if (IS_ERR(common->base)) {
+                               ret = PTR_ERR(common->base);
+                               goto error_unregister;
+                       }
 
                        idle = 0; /* polling delay is not needed */
                }