Skip to content

Commit 5597bfb

Browse files
AxelLinbroonie
authored andcommitted
regulator: tps65218: Add NULL test for devm_kzalloc call
Signed-off-by: Axel Lin <[email protected]> Reviewed-by: Keerthy <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 54f0a51 commit 5597bfb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/regulator/tps65218-regulator.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ static int tps65218_regulator_probe(struct platform_device *pdev)
326326
/* Allocate memory for strobes */
327327
tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) *
328328
TPS65218_NUM_REGULATOR, GFP_KERNEL);
329+
if (!tps->strobes)
330+
return -ENOMEM;
329331

330332
for (i = 0; i < ARRAY_SIZE(regulators); i++) {
331333
rdev = devm_regulator_register(&pdev->dev, &regulators[i],

0 commit comments

Comments
 (0)