From: Niklas Söderlund Date: Wed, 29 Mar 2017 18:43:53 +0000 (+0200) Subject: thermal: rcar_gen3_thermal: record and check number of TSCs found X-Git-Tag: v4.12-rc1~8^2^2^2~12 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=97dad1f1d2b3f2a2a77551849357b7ac38b0b6ff;p=karo-tx-linux.git thermal: rcar_gen3_thermal: record and check number of TSCs found Record how many TSCs are found in struct rcar_gen3_thermal_priv, this is needed to be able to add hardware interrupts for trip points later. Also add a check to make sure at least one TSC is found. Signed-off-by: Niklas Söderlund Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Signed-off-by: Eduardo Valentin --- diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index 9b6bc03dd142..4a08b35533dc 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -75,6 +75,7 @@ struct rcar_gen3_thermal_tsc { struct rcar_gen3_thermal_priv { struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM]; + unsigned int num_tscs; }; struct rcar_gen3_thermal_data { @@ -307,6 +308,13 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) tsc->zone = zone; } + priv->num_tscs = i; + + if (!priv->num_tscs) { + ret = -ENODEV; + goto error_unregister; + } + return 0; error_unregister: