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:
  dereferencing freed memory regulator_fixed_voltage_remove()
  regulator: Fix check of unsigned return value and transmit errors in wm831x_gp_ldo_get_mode()
  regulator: Handle missing constraints in _regulator_disable()
  • Loading branch information
Linus Torvalds committed Nov 17, 2009
2 parents 7b01773 + 80099c7 commit b1219e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,8 @@ static int _regulator_disable(struct regulator_dev *rdev)
return -EIO;

/* are we the last user and permitted to disable ? */
if (rdev->use_count == 1 && !rdev->constraints->always_on) {
if (rdev->use_count == 1 &&
(rdev->constraints && !rdev->constraints->always_on)) {

/* we are last user */
if (_regulator_can_change_status(rdev) &&
Expand Down
5 changes: 2 additions & 3 deletions drivers/regulator/fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,10 @@ static int regulator_fixed_voltage_remove(struct platform_device *pdev)
struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);

regulator_unregister(drvdata->dev);
kfree(drvdata->desc.name);
kfree(drvdata);

if (gpio_is_valid(drvdata->gpio))
gpio_free(drvdata->gpio);
kfree(drvdata->desc.name);
kfree(drvdata);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/regulator/wm831x-ldo.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,18 @@ static unsigned int wm831x_gp_ldo_get_mode(struct regulator_dev *rdev)
struct wm831x *wm831x = ldo->wm831x;
int ctrl_reg = ldo->base + WM831X_LDO_CONTROL;
int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
unsigned int ret;
int ret;

ret = wm831x_reg_read(wm831x, on_reg);
if (ret < 0)
return 0;
return ret;

if (!(ret & WM831X_LDO1_ON_MODE))
return REGULATOR_MODE_NORMAL;

ret = wm831x_reg_read(wm831x, ctrl_reg);
if (ret < 0)
return 0;
return ret;

if (ret & WM831X_LDO1_LP_MODE)
return REGULATOR_MODE_STANDBY;
Expand Down

0 comments on commit b1219e2

Please sign in to comment.