Skip to content

Commit 2542a3f

Browse files
WhiteFox-Projectrafaeljw
authored andcommitted
thermal: int340x: Add NULL check for adev
Not all devices have an ACPI companion fwnode, so adev might be NULL. This is similar to the commit cd2fd6e ("platform/x86: int3472: Check for adev == NULL"). Add a check for adev not being set and return -ENODEV in that case to avoid a possible NULL pointer deref in int3402_thermal_probe(). Note, under the same directory, int3400_thermal_probe() has such a check. Fixes: 77e337c ("Thermal: introduce INT3402 thermal driver") Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250313043611.1212116-1-chenyuan0y@gmail.com [ rjw: Subject edit, added Fixes: ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 80e54e8 commit 2542a3f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/thermal/intel/int340x_thermal/int3402_thermal.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ static int int3402_thermal_probe(struct platform_device *pdev)
4545
struct int3402_thermal_data *d;
4646
int ret;
4747

48+
if (!adev)
49+
return -ENODEV;
50+
4851
if (!acpi_has_method(adev->handle, "_TMP"))
4952
return -ENODEV;
5053

0 commit comments

Comments
 (0)