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

Commit 740d13fc authored by Kranthikumar Kurapati's avatar Kranthikumar Kurapati Committed by Gerrit - the friendly Code Review server
Browse files

msm: thermal: Fix zone id to tsens map lookup



Fix null pointer dereference due to non-initialization
of tsens lookup table.

If tsens map lookup table is not initialized, assign
zone_id to tsens_id.

Change-Id: I911bcc2527bd8e00462f7428d8dead4286368fa1
Acked-by: default avatarJim Granitzki <jamesg@qti.qualcomm.com>
Signed-off-by: default avatarKranthikumar Kurapati <kkurap@codeaurora.org>
parent 848b312e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2226,6 +2226,12 @@ static int zone_id_to_tsen_id(int zone_id, int *tsens_id)
	int i = 0;
	int ret = 0;

	if (!zone_id_tsens_map) {
		pr_debug("zone_id_tsens_map is not initialized.\n");
		*tsens_id = zone_id;
		return ret;
	}

	for (i = 0; i < max_tsens_num; i++) {
		if (zone_id == zone_id_tsens_map[i]) {
			*tsens_id = tsens_id_map[i];