mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
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 <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Zhang Rui <[email protected]>
This commit is contained in:
parent
c6935931c1
commit
87260d3f7a
1 changed files with 1 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue