Skip to content

Commit da46ee1

Browse files
Yang Yingliangbroonie
authored andcommitted
regulator: core: fix module refcount leak in set_supply()
If create_regulator() fails in set_supply(), the module refcount needs be put to keep refcount balanced. Fixes: e2c09ae ("regulator: core: Increase refcount for regulator supply's module") Signed-off-by: Yang Yingliang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 0591b14 commit da46ee1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/regulator/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,7 @@ static int set_supply(struct regulator_dev *rdev,
16461646

16471647
rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY");
16481648
if (rdev->supply == NULL) {
1649+
module_put(supply_rdev->owner);
16491650
err = -ENOMEM;
16501651
return err;
16511652
}

0 commit comments

Comments
 (0)