Skip to content

Commit b1ff96e

Browse files
krzkgregkh
authored andcommitted
regulator: s5m8767: Drop regulators OF node reference
[ Upstream commit a5872bd ] The device node reference obtained with of_get_child_by_name() should be dropped on error paths. Fixes: 26aec00 ("regulator: add device tree support for s5m8767") Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20210121155914.48034-1-krzk@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ac5ab9c commit b1ff96e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎drivers/regulator/s5m8767.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,18 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
544544
rdata = devm_kcalloc(&pdev->dev,
545545
pdata->num_regulators, sizeof(*rdata),
546546
GFP_KERNEL);
547-
if (!rdata)
547+
if (!rdata) {
548+
of_node_put(regulators_np);
548549
return -ENOMEM;
550+
}
549551

550552
rmode = devm_kcalloc(&pdev->dev,
551553
pdata->num_regulators, sizeof(*rmode),
552554
GFP_KERNEL);
553-
if (!rmode)
555+
if (!rmode) {
556+
of_node_put(regulators_np);
554557
return -ENOMEM;
558+
}
555559

556560
pdata->regulators = rdata;
557561
pdata->opmode = rmode;

0 commit comments

Comments
 (0)