diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-07-11 05:27:54 +0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-07-16 17:26:37 +0400 |
commit | 46b65a8fe63ece3b01d7d0c5e3bb5b9f478c44d5 (patch) | |
tree | 5e79493ab517ea4ac97fe0ec9351d8e5dcffd250 /drivers/mfd/88pm800.c | |
parent | e102befe7a254f7b827fecc19eba0c5af03d1bf3 (diff) | |
download | linux-46b65a8fe63ece3b01d7d0c5e3bb5b9f478c44d5.tar.xz |
mfd: Fix checking return value of 88pm8xx regmap_read()
Check the return value of regmap_read() rather than the read value.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/88pm800.c')
-rw-r--r-- | drivers/mfd/88pm800.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index ec7d9b8c7844..b67a3018b136 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -419,22 +419,24 @@ static int __devinit device_800_init(struct pm80x_chip *chip, struct pm80x_platform_data *pdata) { int ret, pmic_id; + unsigned int val; - regmap_read(chip->regmap, PM800_CHIP_ID, &ret); + ret = regmap_read(chip->regmap, PM800_CHIP_ID, &val); if (ret < 0) { dev_err(chip->dev, "Failed to read CHIP ID: %d\n", ret); goto out; } - pmic_id = ret & PM80X_VERSION_MASK; + pmic_id = val & PM80X_VERSION_MASK; if ((pmic_id >= PM800_CHIP_A0) && (pmic_id <= PM800_CHIP_END)) { - chip->version = ret; + chip->version = val; dev_info(chip->dev, - "88PM80x:Marvell 88PM800 (ID:0x%x) detected\n", ret); + "88PM80x:Marvell 88PM800 (ID:0x%x) detected\n", val); } else { dev_err(chip->dev, - "Failed to detect Marvell 88PM800:ChipID[0x%x]\n", ret); + "Failed to detect Marvell 88PM800:ChipID[0x%x]\n", val); + ret = -EINVAL; goto out; } @@ -442,12 +444,12 @@ static int __devinit device_800_init(struct pm80x_chip *chip, * alarm wake up bit will be clear in device_irq_init(), * read before that */ - regmap_read(chip->regmap, PM800_RTC_CONTROL, &ret); + ret = regmap_read(chip->regmap, PM800_RTC_CONTROL, &val); if (ret < 0) { dev_err(chip->dev, "Failed to read RTC register: %d\n", ret); goto out; } - if (ret & PM800_ALARM_WAKEUP) { + if (val & PM800_ALARM_WAKEUP) { if (pdata && pdata->rtc) pdata->rtc->rtc_wakeup = 1; } |