Skip to content

Commit dc64b3d

Browse files
Dan Carpenterbroonie
authored andcommitted
ASoC: codecs: wcd-common: fix signedness bug in wcd_dt_parse_micbias_info()
The error handling does not work because common->micb_vout[] is an array of u32. We need a signed variable to store negative error codes. Fixes: 4f16b63 ("ASoC: codecs: wcd: add common helper for wcd codecs") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Link: https://patch.msgid.link/aNKEZ3VqJ8js208v@stanley.mountain Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 2cc6710 commit dc64b3d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

sound/soc/codecs/wcd-common.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ static int wcd_get_micbias_val(struct device *dev, int micb_num, u32 *micb_mv)
6262

6363
int wcd_dt_parse_micbias_info(struct wcd_common *common)
6464
{
65-
int i;
65+
int ret, i;
6666

6767
for (i = 0; i < common->max_bias; i++) {
68-
common->micb_vout[i] = wcd_get_micbias_val(common->dev, i + 1, &common->micb_mv[i]);
69-
if (common->micb_vout[i] < 0)
70-
return -EINVAL;
68+
ret = wcd_get_micbias_val(common->dev, i + 1, &common->micb_mv[i]);
69+
if (ret < 0)
70+
return ret;
71+
common->micb_vout[i] = ret;
7172
}
7273

7374
return 0;

0 commit comments

Comments
 (0)