diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-06-29 00:17:37 +0200 |
---|---|---|
committer | Lee Jones <lee@kernel.org> | 2022-07-19 11:54:41 +0200 |
commit | 5189952238c965cbf76309f2c29b84ff2ec70b75 (patch) | |
tree | 053ce09a39b4f6e0ef37c0539eb4e6bf127ac793 /drivers/mfd | |
parent | mfd: intel-lpss: Add Intel Meteor Lake-P PCI IDs (diff) | |
download | linux-5189952238c965cbf76309f2c29b84ff2ec70b75.tar.xz linux-5189952238c965cbf76309f2c29b84ff2ec70b75.zip |
mfd: intel_soc_pmic_bxtwc: Don't shadow error codes in show()/store()
kstrtox() along with regmap API can return different error codes based on
circumstances.
Don't shadow them when returning to the caller.
While at it, remove rather confusing message from addr_store().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220628221747.33956-1-andriy.shevchenko@linux.intel.com
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/intel_soc_pmic_bxtwc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c index bc069c4daa60..bdc3153ee890 100644 --- a/drivers/mfd/intel_soc_pmic_bxtwc.c +++ b/drivers/mfd/intel_soc_pmic_bxtwc.c @@ -339,10 +339,12 @@ static ssize_t addr_show(struct device *dev, static ssize_t addr_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - if (kstrtoul(buf, 0, &bxtwc_reg_addr)) { - dev_err(dev, "Invalid register address\n"); - return -EINVAL; - } + int ret; + + ret = kstrtoul(buf, 0, &bxtwc_reg_addr); + if (ret) + return ret; + return (ssize_t)count; } @@ -354,9 +356,9 @@ static ssize_t val_show(struct device *dev, struct intel_soc_pmic *pmic = dev_get_drvdata(dev); ret = regmap_read(pmic->regmap, bxtwc_reg_addr, &val); - if (ret < 0) { + if (ret) { dev_err(dev, "Failed to read 0x%lx\n", bxtwc_reg_addr); - return -EIO; + return ret; } return sprintf(buf, "0x%02x\n", val); @@ -377,7 +379,7 @@ static ssize_t val_store(struct device *dev, if (ret) { dev_err(dev, "Failed to write value 0x%02x to address 0x%lx", val, bxtwc_reg_addr); - return -EIO; + return ret; } return count; } |