Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/lrg/voltage-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6:
  mc13783-regulator: fix a memory leak in mc13783_regulator_remove
  regulator: Let drivers know when they use the stub API
  • Loading branch information
torvalds committed Apr 21, 2010
2 parents 255f41c + 58d5765 commit 458f8c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions drivers/regulator/mc13783-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,12 @@ static int __devexit mc13783_regulator_remove(struct platform_device *pdev)
dev_get_platdata(&pdev->dev);
int i;

platform_set_drvdata(pdev, NULL);

for (i = 0; i < pdata->num_regulators; i++)
regulator_unregister(priv->regulators[i]);

kfree(priv);
return 0;
}

Expand Down
8 changes: 6 additions & 2 deletions include/linux/regulator/consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev,
{
/* Nothing except the stubbed out regulator API should be
* looking at the value except to check if it is an error
* value so the actual return value doesn't matter.
* value. Drivers are free to handle NULL specifically by
* skipping all regulator API calls, but they don't have to.
* Drivers which don't, should make sure they properly handle
* corner cases of the API, such as regulator_get_voltage()
* returning 0.
*/
return (struct regulator *)id;
return NULL;
}
static inline void regulator_put(struct regulator *regulator)
{
Expand Down

0 comments on commit 458f8c8

Please sign in to comment.