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

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

Merge "devfreq: Fix possible race in tz_start() handler"

parents 0446c371 a2d4f1e7
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2010-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2010-2020, The Linux Foundation. All rights reserved.
 */
#include <linux/errno.h>
#include <linux/module.h>
@@ -470,9 +470,12 @@ static int tz_start(struct devfreq *devfreq)
	unsigned int tz_pwrlevels[MSM_ADRENO_MAX_PWRLEVELS + 1];
	int i, out, ret;
	unsigned int version;
	struct msm_adreno_extended_profile *gpu_profile;

	if (partner_gpu_profile)
		return -EEXIST;

	struct msm_adreno_extended_profile *gpu_profile = container_of(
					(devfreq->profile),
	gpu_profile = container_of(devfreq->profile,
			struct msm_adreno_extended_profile,
			profile);

@@ -495,6 +498,7 @@ static int tz_start(struct devfreq *devfreq)
		tz_pwrlevels[0] = i;
	} else {
		pr_err(TAG "tz_pwrlevels[] is too short\n");
		partner_gpu_profile = NULL;
		return -EINVAL;
	}

@@ -511,6 +515,7 @@ static int tz_start(struct devfreq *devfreq)
				sizeof(version));
	if (ret != 0 || version > MAX_TZ_VERSION) {
		pr_err(TAG "tz_init failed\n");
		partner_gpu_profile = NULL;
		return ret;
	}

@@ -606,7 +611,7 @@ static int tz_handler(struct devfreq *devfreq, unsigned int event, void *data)
		break;
	}

	if (partner_gpu_profile && partner_gpu_profile->bus_devfreq)
	if (!result && partner_gpu_profile && partner_gpu_profile->bus_devfreq)
		switch (event) {
		case DEVFREQ_GOV_START:
			queue_work(workqueue,