mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
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: 4f16b6351b ("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>
This commit is contained in:
committed by
Mark Brown
parent
2cc6710595
commit
dc64b3d42c
@@ -62,12 +62,13 @@ static int wcd_get_micbias_val(struct device *dev, int micb_num, u32 *micb_mv)
|
||||
|
||||
int wcd_dt_parse_micbias_info(struct wcd_common *common)
|
||||
{
|
||||
int i;
|
||||
int ret, i;
|
||||
|
||||
for (i = 0; i < common->max_bias; i++) {
|
||||
common->micb_vout[i] = wcd_get_micbias_val(common->dev, i + 1, &common->micb_mv[i]);
|
||||
if (common->micb_vout[i] < 0)
|
||||
return -EINVAL;
|
||||
ret = wcd_get_micbias_val(common->dev, i + 1, &common->micb_mv[i]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
common->micb_vout[i] = ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user