Showing error 1585

User: Jiri Slaby
Error type: Leaving function in locked state
Error type description: Some lock is not unlocked on all paths of a function, so it is leaked
File location: drivers/thermal/thermal_sys.c
Line in file: 488
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2012-05-29 20:11:37 UTC


Source:

458 * @tz:                thermal zone device
459 * @trip:        indicates which trip point the cooling devices is
460 *                associated with in this thermal zone.
461 * @cdev:        thermal cooling device
462 *
463 * This function is usually called in the thermal zone device .bind callback.
464 */
465int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
466                                     int trip,
467                                     struct thermal_cooling_device *cdev)
468{
469        struct thermal_cooling_device_instance *dev;
470        struct thermal_cooling_device_instance *pos;
471        struct thermal_zone_device *pos1;
472        struct thermal_cooling_device *pos2;
473        int result;
474
475        if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE))
476                return -EINVAL;
477
478        list_for_each_entry(pos1, &thermal_tz_list, node) {
479                if (pos1 == tz)
480                        break;
481        }
482        list_for_each_entry(pos2, &thermal_cdev_list, node) {
483                if (pos2 == cdev)
484                        break;
485        }
486
487        if (tz != pos1 || cdev != pos2)
488                return -EINVAL;
489
490        dev =
491            kzalloc(sizeof(struct thermal_cooling_device_instance), GFP_KERNEL);
492        if (!dev)
493                return -ENOMEM;
494        dev->tz = tz;
495        dev->cdev = cdev;
496        dev->trip = trip;
497        result = get_idr(&tz->idr, &tz->lock, &dev->id);
498        if (result)
Show full sources