Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e444858 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: thermal: Use lock before accessing thermal instance list"

parents dabe1619 014d6e75
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -107,12 +107,16 @@ config_show(struct device *dev, struct device_attribute *attr, char *buf)
	buf_offset = 0;
	buf1_offset = 0;
	buf2_offset = 0;

	mutex_lock(&tz->lock);
	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
		if (instance->cdev)
			buf_size++;
	}
	if (!buf_size)
	if (!buf_size) {
		mutex_unlock(&tz->lock);
		goto config_exit;
	}
	buf_size *= THERMAL_NAME_LENGTH;
	buf_cdev =  kzalloc(buf_size, GFP_KERNEL);
	buf_cdev_upper = kzalloc(buf_size, GFP_KERNEL);
@@ -153,6 +157,8 @@ config_show(struct device *dev, struct device_attribute *attr, char *buf)
			}
		}
	}
	mutex_unlock(&tz->lock);

	offset += scnprintf(buf + offset, PAGE_SIZE - offset,
				"device %s\n", buf_cdev);
	offset += scnprintf(buf + offset, PAGE_SIZE - offset,