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

Commit 9ea3e6ff authored by Rajesh Kemisetti's avatar Rajesh Kemisetti
Browse files

msm: kgsl: Add NULL check for kgsl_midframe before accessing it



in kgsl_pwrscale_init(), add missing NULL check for kgsl_midframe
to avoid further accessing, in case if memory is not available.

Change-Id: If6a4e59d4675fe67aefc63d7f8251f4d28ddeec5
Signed-off-by: default avatarRajesh Kemisetti <rajeshk@codeaurora.org>
parent 2e47ba9a
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
/* Copyright (c) 2010-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -917,11 +917,15 @@ int kgsl_pwrscale_init(struct device *dev, const char *governor)
			"qcom,enable-midframe-timer")) {
		kgsl_midframe = kzalloc(
				sizeof(struct kgsl_midframe_info), GFP_KERNEL);
		if (kgsl_midframe) {
			hrtimer_init(&kgsl_midframe->timer,
					CLOCK_MONOTONIC, HRTIMER_MODE_REL);
			kgsl_midframe->timer.function =
					kgsl_pwrscale_midframe_timer;
			kgsl_midframe->device = device;
		} else
			KGSL_PWR_ERR(device,
				"Failed to enable-midframe-timer feature\n");
	}

	/*