summaryrefslogtreecommitdiff
path: root/drivers/power/pmic/rk808.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-01-21 19:43:58 -0700
committerSimon Glass <sjg@chromium.org>2016-01-21 20:42:35 -0700
commit7d5779993dbc487695fbfe88716fd70618a5db99 (patch)
tree593db3bb18fc6a5ac3f521f020b674bcc87618ba /drivers/power/pmic/rk808.c
parent1b30d61d786421a5d02725a9945552cc9c09914b (diff)
dm: power: Tidy up debugging output and return values
The currect PMIC debugging is a little confusing. Adjust it so that it is clear whether the operation succeeded or failed. Also, avoid creating a new error return value when a perfectly good one is already available. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/power/pmic/rk808.c')
-rw-r--r--drivers/power/pmic/rk808.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/power/pmic/rk808.c b/drivers/power/pmic/rk808.c
index 11d5f07767..770f471672 100644
--- a/drivers/power/pmic/rk808.c
+++ b/drivers/power/pmic/rk808.c
@@ -30,9 +30,12 @@ static int rk808_reg_count(struct udevice *dev)
static int rk808_write(struct udevice *dev, uint reg, const uint8_t *buff,
int len)
{
- if (dm_i2c_write(dev, reg, buff, len)) {
+ int ret;
+
+ ret = dm_i2c_write(dev, reg, buff, len);
+ if (ret) {
debug("write error to device: %p register: %#x!", dev, reg);
- return -EIO;
+ return ret;
}
return 0;
@@ -40,9 +43,12 @@ static int rk808_write(struct udevice *dev, uint reg, const uint8_t *buff,
static int rk808_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
{
- if (dm_i2c_read(dev, reg, buff, len)) {
+ int ret;
+
+ ret = dm_i2c_read(dev, reg, buff, len);
+ if (ret) {
debug("read error from device: %p register: %#x!", dev, reg);
- return -EIO;
+ return ret;
}
return 0;