Commit b1219e24 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/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()
parents 7b01773b 80099c70
...@@ -1283,7 +1283,8 @@ static int _regulator_disable(struct regulator_dev *rdev) ...@@ -1283,7 +1283,8 @@ static int _regulator_disable(struct regulator_dev *rdev)
return -EIO; return -EIO;
/* are we the last user and permitted to disable ? */ /* 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 */ /* we are last user */
if (_regulator_can_change_status(rdev) && if (_regulator_can_change_status(rdev) &&
......
...@@ -196,11 +196,10 @@ static int regulator_fixed_voltage_remove(struct platform_device *pdev) ...@@ -196,11 +196,10 @@ static int regulator_fixed_voltage_remove(struct platform_device *pdev)
struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev); struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
regulator_unregister(drvdata->dev); regulator_unregister(drvdata->dev);
kfree(drvdata->desc.name);
kfree(drvdata);
if (gpio_is_valid(drvdata->gpio)) if (gpio_is_valid(drvdata->gpio))
gpio_free(drvdata->gpio); gpio_free(drvdata->gpio);
kfree(drvdata->desc.name);
kfree(drvdata);
return 0; return 0;
} }
......
...@@ -175,18 +175,18 @@ static unsigned int wm831x_gp_ldo_get_mode(struct regulator_dev *rdev) ...@@ -175,18 +175,18 @@ static unsigned int wm831x_gp_ldo_get_mode(struct regulator_dev *rdev)
struct wm831x *wm831x = ldo->wm831x; struct wm831x *wm831x = ldo->wm831x;
int ctrl_reg = ldo->base + WM831X_LDO_CONTROL; int ctrl_reg = ldo->base + WM831X_LDO_CONTROL;
int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
unsigned int ret; int ret;
ret = wm831x_reg_read(wm831x, on_reg); ret = wm831x_reg_read(wm831x, on_reg);
if (ret < 0) if (ret < 0)
return 0; return ret;
if (!(ret & WM831X_LDO1_ON_MODE)) if (!(ret & WM831X_LDO1_ON_MODE))
return REGULATOR_MODE_NORMAL; return REGULATOR_MODE_NORMAL;
ret = wm831x_reg_read(wm831x, ctrl_reg); ret = wm831x_reg_read(wm831x, ctrl_reg);
if (ret < 0) if (ret < 0)
return 0; return ret;
if (ret & WM831X_LDO1_LP_MODE) if (ret & WM831X_LDO1_LP_MODE)
return REGULATOR_MODE_STANDBY; return REGULATOR_MODE_STANDBY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment