Commit 01aaae6b authored by ZhaoLong Wang's avatar ZhaoLong Wang Committed by openeuler-sync-bot
Browse files

hikey9xx: Fixed incorrect use of kfree to free sreg

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6GS86


CVE: NA

--------------------------------

When memory allocated by using the devm_kmalloc(). the matching
release function should use the devm_kfree() function instead of
the kfree() function.

@sreg allocated:
hi6421_spmi_regulator_probe
  hi6421_spmi_regulator_probe_ldo

@sreg freed:
hi6421_spmi_regulator_remove

Signed-off-by: default avatarZhaoLong Wang <wangzhaolong1@huawei.com>
(cherry picked from commit 8a31aa41)
parent 0d704970
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -452,7 +452,7 @@ static int hi6421_spmi_regulator_remove(struct platform_device *pdev)
	if (rdev->desc->volt_table)
		devm_kfree(&pdev->dev, (unsigned int *)rdev->desc->volt_table);

	kfree(sreg);
	devm_kfree(&pdev->dev, sreg);

	return 0;
}