Skip to content

Commit

Permalink
regulator: Don't create voltage sysfs entries if we can't read voltage
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Nov 23, 2011
1 parent aebe495 commit 4c78899
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,8 @@ static int add_regulator_attributes(struct regulator_dev *rdev)
int status = 0;

/* some attributes need specific methods to be displayed */
if (ops->get_voltage || ops->get_voltage_sel) {
if ((ops->get_voltage && ops->get_voltage(rdev) >= 0) ||
(ops->get_voltage_sel && ops->get_voltage_sel(rdev) >= 0)) {
status = device_create_file(dev, &dev_attr_microvolts);
if (status < 0)
return status;
Expand Down

0 comments on commit 4c78899

Please sign in to comment.