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

Commit a4a4f738 authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi Committed by Gerrit - the friendly Code Review server
Browse files

msm: thermal: Revert devm_kzalloc to kzalloc in sensor manager APIs



Sensor manager APIs uses devm_kzalloc to allocate memory for
thresholds. If probe is deferred, device related memory releases.
Later during re-probe, driver doesn't re-initialize all thresholds
which was successsful during first probe, which causes unexpected
values in previously initialized thresholds. Revert devm_kzalloc and
devm_kfree to kzalloc and kfree respectively in sensor manager APIs.

Change-Id: If1f39274e97c201d542b02fd501dbf60fac87de9
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent f0fc4f38
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -3879,8 +3879,7 @@ int sensor_mgr_init_threshold(struct device *dev,
	thresh_inp->thresh_ct = (sensor_id == MONITOR_ALL_TSENS) ?
						max_tsens_num : 1;
	thresh_inp->thresh_triggered = false;
	thresh_inp->thresh_list = devm_kzalloc(dev,
					sizeof(struct therm_threshold) *
	thresh_inp->thresh_list = kzalloc(sizeof(struct therm_threshold) *
					thresh_inp->thresh_ct, GFP_KERNEL);
	if (!thresh_inp->thresh_list) {
		pr_err("kzalloc failed for thresh\n");
@@ -3949,7 +3948,7 @@ void sensor_mgr_remove_threshold(struct device *dev,
		sensor_cancel_trip(thresh_ptr->sensor_id,
				&thresh_ptr->threshold[1]);
	}
	devm_kfree(dev, thresh_inp->thresh_list);
	kfree(thresh_inp->thresh_list);
	thresh_inp->thresh_list = NULL;
	thresh_inp->thresh_ct = 0;
	thresh_inp->thresh_triggered = false;