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

Commit 468fc934 authored by Venkateswara Rao Tadikonda's avatar Venkateswara Rao Tadikonda
Browse files

msm: kgsl: Change pwrlevels array index type to unsigned int



Change the array index 'i' of pwrlevels[] to unsigned int, which can't be
decremented beyond zero.

Change-Id: I9b646fccf03437f6facf0d5938f097916d13d2f2
Signed-off-by: default avatarVenkateswara Rao Tadikonda <vtadik@codeaurora.org>
parent d9fbe4b9
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -522,7 +522,8 @@ int kgsl_devfreq_target(struct device *dev, unsigned long *freq, u32 flags)
	struct kgsl_device *device = dev_get_drvdata(dev);
	struct kgsl_pwrctrl *pwr;
	struct kgsl_pwrlevel *pwr_level;
	int level, i;
	int level;
	unsigned int i;
	unsigned long cur_freq;

	if (device == NULL)
@@ -551,10 +552,11 @@ int kgsl_devfreq_target(struct device *dev, unsigned long *freq, u32 flags)
	if (*freq != cur_freq) {
		level = pwr->max_pwrlevel;
		/*
		 * To avoid infinite loop issue type cast max_pwrlevel to
		 * signed integer type
		 * Array index of pwrlevels[] should be within the permitted
		 * power levels, i.e., from max_pwrlevel to min_pwrlevel.
		 */
		for (i = pwr->min_pwrlevel; i >= (int)pwr->max_pwrlevel; i--)
		for (i = pwr->min_pwrlevel; (i >= pwr->max_pwrlevel
					&& i <= pwr->min_pwrlevel); i--)
			if (*freq <= pwr->pwrlevels[i].gpu_freq) {
				if (pwr->thermal_cycle == CYCLE_ACTIVE)
					level = _thermal_adjust(pwr, i);