Skip to content

Commit

Permalink
regulator: mtk-dvfsrc: Fix wrong dev pointer for devm_regulator_register
Browse files Browse the repository at this point in the history
If use dev->parent, the regulator_unregister will not be called when this
driver is unloaded. Fix it by using dev instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210702142140.2678130-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Jul 7, 2021
1 parent c9cd752 commit ea98690
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/regulator/mtk-dvfsrc-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev)
for (i = 0; i < regulator_init_data->size; i++) {
config.dev = dev->parent;
config.driver_data = (mt_regulators + i);
rdev = devm_regulator_register(dev->parent,
&(mt_regulators + i)->desc,
rdev = devm_regulator_register(dev, &(mt_regulators + i)->desc,
&config);
if (IS_ERR(rdev)) {
dev_err(dev, "failed to register %s\n",
Expand Down

0 comments on commit ea98690

Please sign in to comment.