mirror of https://gitee.com/openkylin/linux.git
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()
This commit is contained in:
commit
b1219e24c0
|
@ -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) &&
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue