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

Unverified Commit 4f919ca2 authored by Anton Vasilyev's avatar Anton Vasilyev Committed by Mark Brown
Browse files

regulator: tps65217: Fix NULL pointer dereference on probe



There is no check that tps->strobes is allocated successfully in
tps65217_regulator_probe().
The patch adds corresponding check.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: default avatarAnton Vasilyev <vasilyev@ispras.ru>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6c0b319c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -232,6 +232,8 @@ static int tps65217_regulator_probe(struct platform_device *pdev)
	tps->strobes = devm_kcalloc(&pdev->dev,
				    TPS65217_NUM_REGULATOR, sizeof(u8),
				    GFP_KERNEL);
	if (!tps->strobes)
		return -ENOMEM;

	platform_set_drvdata(pdev, tps);