]> git.sur5r.net Git - u-boot/commitdiff
pmic_i2c: Return error in case of invalid pmic_i2c_tx_num
authorFabio Estevam <festevam@gmail.com>
Fri, 16 Mar 2012 11:32:09 +0000 (11:32 +0000)
committerStefano Babic <sbabic@denx.de>
Tue, 27 Mar 2012 07:41:16 +0000 (09:41 +0200)
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>
drivers/misc/pmic_i2c.c

index ad55d6447e37a23f9917eb864ae7d17bde56713a..95a3365b9fc72a481ded1937d4293b1fb6cb4042 100644 (file)
@@ -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));