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

Commit 779a2810 authored by Tirupathi Reddy's avatar Tirupathi Reddy
Browse files

regulator: msm_gfx_ldo: fix null pointer dereference



Fix a possible null dereference after a runtime memory
allocation made for volt_adjust local variable.

CRs-Fixed: 1106624
Change-Id: I45eedc24e98dede75e7e4bf1374f582d95c3e9b2
Signed-off-by: default avatarTirupathi Reddy <tirupath@codeaurora.org>
parent 351c0011
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * 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
 * it under the terms of the GNU General Public License version 2 and
@@ -764,6 +764,9 @@ static int msm_gfx_ldo_adjust_init_voltage(struct msm_gfx_ldo *ldo_vreg)


	volt_adjust = devm_kcalloc(ldo_vreg->dev, size, sizeof(*volt_adjust),
	volt_adjust = devm_kcalloc(ldo_vreg->dev, size, sizeof(*volt_adjust),
								GFP_KERNEL);
								GFP_KERNEL);
	if (!volt_adjust)
		return -ENOMEM;

	rc = of_property_read_u32_array(of_node, prop_name, volt_adjust, size);
	rc = of_property_read_u32_array(of_node, prop_name, volt_adjust, size);
	if (rc) {
	if (rc) {
		pr_err("failed to read %s property rc=%d\n", prop_name, rc);
		pr_err("failed to read %s property rc=%d\n", prop_name, rc);