From 4a16c190f761cb3a87dcbbf355f91c71ce1f8c0b Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 1 Mar 2023 21:14:36 +0100 Subject: thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() The devres variant of thermal_add_hwmon_sysfs() only takes the thermal zone structure pointer as parameter. Actually, it uses the tz->device to add it in the devres list. It is preferable to use the device registering the thermal zone instead of the thermal zone device itself. That prevents the driver accessing the thermal zone structure internals and it is from my POV more correct regarding how devm_ is used. Signed-off-by: Daniel Lezcano Acked-by: Martin Blumenstingl #amlogic_thermal Acked-by: Jernej Skrabec #sun8i_thermal Reviewed-by: AngeloGioacchino Del Regno #MediaTek auxadc Signed-off-by: Rafael J. Wysocki --- drivers/thermal/tegra/tegra30-tsensor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/thermal/tegra') diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c index 42c6fb494dd9..4b2ea17910cd 100644 --- a/drivers/thermal/tegra/tegra30-tsensor.c +++ b/drivers/thermal/tegra/tegra30-tsensor.c @@ -528,7 +528,7 @@ static int tegra_tsensor_register_channel(struct tegra_tsensor *ts, return 0; } - if (devm_thermal_add_hwmon_sysfs(tsc->tzd)) + if (devm_thermal_add_hwmon_sysfs(ts->dev, tsc->tzd)) dev_warn(ts->dev, "failed to add hwmon sysfs attributes\n"); return 0; -- cgit v1.2.3