summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Behme <dirk.behme@de.bosch.com>2016-04-21 12:24:55 +0200
committerZhang Rui <rui.zhang@intel.com>2016-09-06 20:46:06 +0800
commit87260d3f7aecba9a5fadc6886c338b2a8fccfca9 (patch)
tree8e5a28672e5db63939e28d2a65b84b8beecd9f26
parentc6935931c1894ff857616ff8549b61236a19148f (diff)
downloadlinux-87260d3f7aecba9a5fadc6886c338b2a8fccfca9.tar.gz
linux-87260d3f7aecba9a5fadc6886c338b2a8fccfca9.tar.xz
thermal: rcar_thermal: Fix priv->zone error handling
In case thermal_zone_xxx_register() returns an error, priv->zone isn't NULL any more, but contains the error code. This is passed to thermal_zone_device_unregister(), then. This checks for priv->zone being NULL, but the error code is != NULL. So it works with the error code as a pointer. Crashing immediately. To fix this, reset priv->zone to NULL before entering rcar_gen3_thermal_remove(). Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r--drivers/thermal/rcar_thermal.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 71a339271fa5..5f817923f374 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -504,6 +504,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
if (IS_ERR(priv->zone)) {
dev_err(dev, "can't register thermal zone\n");
ret = PTR_ERR(priv->zone);
+ priv->zone = NULL;
goto error_unregister;
}