Skip to content

Commit 97dad1f

Browse files
Niklas SöderlundEduardo Valentin
authored andcommitted
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 <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Eduardo Valentin <[email protected]>
1 parent d51546c commit 97dad1f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/thermal/rcar_gen3_thermal.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ struct rcar_gen3_thermal_tsc {
7575

7676
struct rcar_gen3_thermal_priv {
7777
struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM];
78+
unsigned int num_tscs;
7879
};
7980

8081
struct rcar_gen3_thermal_data {
@@ -307,6 +308,13 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
307308
tsc->zone = zone;
308309
}
309310

311+
priv->num_tscs = i;
312+
313+
if (!priv->num_tscs) {
314+
ret = -ENODEV;
315+
goto error_unregister;
316+
}
317+
310318
return 0;
311319

312320
error_unregister:

0 commit comments

Comments
 (0)