diff --git a/drivers/power/supply/qcom/smb1355-charger.c b/drivers/power/supply/qcom/smb1355-charger.c index 52b89f454a2b..3c8ab4f77602 100644 --- a/drivers/power/supply/qcom/smb1355-charger.c +++ b/drivers/power/supply/qcom/smb1355-charger.c @@ -672,9 +672,8 @@ done: return rc; } -static int smb1355_get_prop_constant_charge_current_max( - struct smb1355 *chip, - int *val) +static int smb1355_get_prop_constant_charge_current_max(struct smb1355 *chip, + int *val) { int rc = 0; @@ -1038,18 +1037,18 @@ static int smb1355_iio_read_raw(struct iio_dev *indio_dev, *val1 = 0; break; default: - pr_err_ratelimited("SMB1355 IIO channel %d not supported\n", + pr_err_ratelimited("SMB1355 IIO channel %x not supported\n", chan->channel); return -EINVAL; } if (rc < 0) { - pr_debug("Couldn't read channel %d rc = %d\n", + pr_debug("Couldn't read channel %x rc = %d\n", chan->channel, rc); return -ENODATA; } - return rc ? rc : IIO_VAL_INT; + return IIO_VAL_INT; } static int smb1355_iio_write_raw(struct iio_dev *indio_dev, @@ -1093,10 +1092,12 @@ static int smb1355_iio_write_raw(struct iio_dev *indio_dev, rc = smb1355_clk_request(chip, false); break; default: - pr_debug("SMB1355 IIO write channel %d not supported\n", - chan->channel); rc = -EINVAL; } + + if (rc < 0) + pr_debug("Couldn't write to channel %x rc = %d\n", + chan->channel, rc); done: mutex_unlock(&chip->suspend_lock); return rc; diff --git a/drivers/power/supply/qcom/smb1398-charger.c b/drivers/power/supply/qcom/smb1398-charger.c index f24c00fc0abd..25c0d95d2507 100644 --- a/drivers/power/supply/qcom/smb1398-charger.c +++ b/drivers/power/supply/qcom/smb1398-charger.c @@ -2450,8 +2450,6 @@ static const struct cp_iio_prop_channels cp_master_chans[] = { static int cp_master_iio_set_prop(struct smb1398_chip *chip, int channel, int val) { - int rc = 0; - switch (channel) { case PSY_IIO_CP_ENABLE: vote(chip->div2_cp_disable_votable, @@ -2471,8 +2469,7 @@ static int cp_master_iio_set_prop(struct smb1398_chip *chip, break; default: pr_err("get prop %d is not supported\n", channel); - rc = -EINVAL; - break; + return -EINVAL; } return 0; @@ -2526,11 +2523,11 @@ static int cp_master_iio_get_prop(struct smb1398_chip *chip, * Return the cached values when the system is in suspend state * instead of reading the registers to avoid read failures. */ - if (chip->in_suspend) { rc = cp_master_iio_get_prop_in_suspend(chip, channel, val); if (!rc) - return rc; + return IIO_VAL_INT; + rc = 0; } switch (channel) { @@ -2697,8 +2694,6 @@ static int cp_slave_iio_set_prop(struct smb1398_chip *chip, static int cp_slave_iio_get_prop(struct smb1398_chip *chip, int channel, int *val) { - int rc = 0; - switch (channel) { case PSY_IIO_CP_ENABLE: *val = chip->switcher_en; @@ -2716,8 +2711,7 @@ static int cp_slave_iio_get_prop(struct smb1398_chip *chip, break; default: pr_err("get prop %d is not supported\n", channel); - rc = -EINVAL; - break; + return -EINVAL; } return IIO_VAL_INT;