[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1305723718.6172.6.camel@phoenix>
Date: Wed, 18 May 2011 21:01:58 +0800
From: Axel Lin <axel.lin@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Liam Girdwood <lrg@...mlogic.co.uk>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: [RFC][PATCH] regulator: Fix _regulator_get_voltage if get_voltage
callback is NULL
In the case of get_voltage callback is NULL, current implementation in
_regulator_get_voltage will return -EINVAL.
Also returns proper error if ret is negative value.
Signed-off-by: Axel Lin <axel.lin@...il.com>
---
hi Mark,
I just found in commit 6b8e70 "regulator: Convert WM8400 to get_voltage_sel()",
you added get_voltage_sel callback and remove get_voltage callback.
I suspect you will hit this bug. Can you check it?
Thanks,
Axel
drivers/regulator/core.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 9493f61..2262474 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1886,13 +1886,15 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
if (sel < 0)
return sel;
ret = rdev->desc->ops->list_voltage(rdev, sel);
+ goto out;
}
if (rdev->desc->ops->get_voltage)
ret = rdev->desc->ops->get_voltage(rdev);
else
return -EINVAL;
- return ret - rdev->constraints->uV_offset;
+out:
+ return ret < 0 ? ret : ret - rdev->constraints->uV_offset;
}
/**
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists