mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 03:27:03 +02:00
soc: qcom: qti_battery_debug: Add NULL check
Ensure that valid memory is allocated for the array of all votables before an attempt is made to populate it. Change-Id: I9a0c3e35e345a88560e39d47484348b6c476628d Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
This commit is contained in:
parent
cd857f2b69
commit
e4ea2b8741
|
|
@ -615,6 +615,8 @@ static int battery_dbg_create_votables(struct battery_dbg_dev *bd,
|
|||
|
||||
bd->votable = devm_kcalloc(bd->dev, num_votables,
|
||||
sizeof(struct votable), GFP_KERNEL);
|
||||
if (!bd->votable)
|
||||
return -ENOMEM;
|
||||
|
||||
for (id = 0; id < num_votables; id++) {
|
||||
bd->votable[id].bd = bd;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user