Writing to crit_current_X node caused an infinite loop due to
incorrect return value of ina3221_set_channel() function. This patch
addresses this issue.
Change-Id: I883c21418f0ec6c215107576d914c1d29e577a6d
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: http://git-master/r/383083
(cherry picked from commit
49f5e9c0b7ba5870c3a132d9aec8fe81e53e3366)
Reviewed-on: http://git-master/r/385212
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
int channel = UNPACK_CHAN(this_attr->address);
long val;
int current_ma;
+ int ret;
if (channel >= 3) {
dev_err(dev, "Invalid channel Id %d\n", channel);
return -EINVAL;
current_ma = (int) val;
- return ina3221_set_channel_critical(chip, channel, current_ma);
+ ret = ina3221_set_channel_critical(chip, channel, current_ma);
+ return ret < 0 ? ret : len;
case RUNNING_MODE:
return ina3221_set_mode(chip, buf, len);