6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ChiYuan Huang cy_huang@richtek.com
[ Upstream commit 9b45744bf09fc2a3287e05287141d6e123c125a7 ]
The vshunt/current reported register is a signed 16bit integer. The sign bit index should be '15', not '16'.
Fixes: 4396f45d211b ("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 --- drivers/iio/adc/rtq6056.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/iio/adc/rtq6056.c +++ b/drivers/iio/adc/rtq6056.c @@ -171,7 +171,7 @@ static int rtq6056_adc_read_channel(stru if (addr == RTQ6056_REG_BUSVOLT || addr == RTQ6056_REG_POWER) *val = regval; else - *val = sign_extend32(regval, 16); + *val = sign_extend32(regval, 15);
return IIO_VAL_INT; }