Skip to content

Commit a395121

Browse files
ChiYuan Huanggregkh
authored andcommitted
iio: adc: rtq6056: Correct the sign bit index
[ Upstream commit 9b45744 ] The vshunt/current reported register is a signed 16bit integer. The sign bit index should be '15', not '16'. Fixes: 4396f45 ("iio: adc: Add rtq6056 support") Reported-by: Andy Hsu <andy_ya_hsu@wiwynn.com> Signed-off-by: ChiYuan Huang <cy_huang@richtek.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> [ adapted switch statement to existing if-else structure for sign_extend32() fix ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 094f10f commit a395121

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/iio/adc/rtq6056.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static int rtq6056_adc_read_channel(struct rtq6056_priv *priv,
171171
if (addr == RTQ6056_REG_BUSVOLT || addr == RTQ6056_REG_POWER)
172172
*val = regval;
173173
else
174-
*val = sign_extend32(regval, 16);
174+
*val = sign_extend32(regval, 15);
175175

176176
return IIO_VAL_INT;
177177
}

0 commit comments

Comments
 (0)