diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/thermal/thermal.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c index e782b3e7fcdb..5f1d318f0574 100644 --- a/drivers/thermal/thermal.c +++ b/drivers/thermal/thermal.c | |||
@@ -306,12 +306,23 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, | |||
306 | { | 306 | { |
307 | struct thermal_cooling_device_instance *dev; | 307 | struct thermal_cooling_device_instance *dev; |
308 | struct thermal_cooling_device_instance *pos; | 308 | struct thermal_cooling_device_instance *pos; |
309 | struct thermal_zone_device *pos1; | ||
310 | struct thermal_cooling_device *pos2; | ||
309 | int result; | 311 | int result; |
310 | 312 | ||
311 | if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) | 313 | if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) |
312 | return -EINVAL; | 314 | return -EINVAL; |
313 | 315 | ||
314 | if (!tz || !cdev) | 316 | list_for_each_entry(pos1, &thermal_tz_list, node) { |
317 | if (pos1 == tz) | ||
318 | break; | ||
319 | } | ||
320 | list_for_each_entry(pos2, &thermal_cdev_list, node) { | ||
321 | if (pos2 == cdev) | ||
322 | break; | ||
323 | } | ||
324 | |||
325 | if (tz != pos1 || cdev != pos2) | ||
315 | return -EINVAL; | 326 | return -EINVAL; |
316 | 327 | ||
317 | dev = | 328 | dev = |