summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFabio Estevam <festevam@gmail.com>2012-03-16 11:32:09 +0000
committerStefano Babic <sbabic@denx.de>2012-03-27 09:41:16 +0200
commita22429d2bfaa16588635a02958ebcd06114dd697 (patch)
tree0560d6c75db6bc7de9b90dccb798d3182e833f8b /drivers
parent334bd0e225ade19f3a3ac91e4f89fe8a2c6ea0b5 (diff)
pmic_i2c: Return error in case of invalid pmic_i2c_tx_num
Return error in case of invalid pmic_i2c_tx_num. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/pmic_i2c.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/misc/pmic_i2c.c b/drivers/misc/pmic_i2c.c
index ad55d6447e3..95a3365b9fc 100644
--- a/drivers/misc/pmic_i2c.c
+++ b/drivers/misc/pmic_i2c.c
@@ -47,6 +47,9 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
case 1:
buf[0] = val & 0xff;
break;
+ default:
+ printf("%s: invalid tx_num: %d", __func__, pmic_i2c_tx_num);
+ return -1;
}
if (i2c_write(pmic_i2c_addr, reg, 1, buf, pmic_i2c_tx_num))
@@ -73,6 +76,9 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
case 1:
ret_val = buf[0];
break;
+ default:
+ printf("%s: invalid tx_num: %d", __func__, pmic_i2c_tx_num);
+ return -1;
}
memcpy(val, &ret_val, sizeof(ret_val));