Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: axp20x: Fix reference cout leak

Decrements the reference count of device node and its child node.

Fixes: dfe7a1b058bb ("regulator: AXP20x: Add support for regulators subsystem")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/20210120123313.107640-1-bianpan2016@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Pan Bian and committed by
Mark Brown
e78bf6be f35f6d8c

+3 -4
+3 -4
drivers/regulator/axp20x-regulator.c
··· 1070 1070 static int axp20x_regulator_parse_dt(struct platform_device *pdev) 1071 1071 { 1072 1072 struct device_node *np, *regulators; 1073 - int ret; 1073 + int ret = 0; 1074 1074 u32 dcdcfreq = 0; 1075 1075 1076 1076 np = of_node_get(pdev->dev.parent->of_node); ··· 1085 1085 ret = axp20x_set_dcdc_freq(pdev, dcdcfreq); 1086 1086 if (ret < 0) { 1087 1087 dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret); 1088 - return ret; 1089 1088 } 1090 - 1091 1089 of_node_put(regulators); 1092 1090 } 1093 1091 1094 - return 0; 1092 + of_node_put(np); 1093 + return ret; 1095 1094 } 1096 1095 1097 1096 static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode)