cppcheck reports warnings in MTK code
src/drivers/mediatek/mt8195/afe-drv.c:304:9: style: Checking if unsigned expression 'fs' is less than zero. [unsignedLessThanZero]
if (fs < 0)
^
Looking at the code, there are multiple places with signed/unsigned confusions
static unsigned int mt8195_afe_fs_timing(unsigned int rate)
{
int i;
for (i = 0; i < ARRAY_SIZE(mt8195_afe_rates); i++)
if (mt8195_afe_rates[i].rate == rate)
return mt8195_afe_rates[i].reg_value;
return -EINVAL; <<< that's not right for unsigned int!
}
int afe_irq_config(struct mtk_base_afe *afe, int id, unsigned int rate, unsigned int period)
{
struct mtk_base_afe_irq *irq = &afe->irqs[id];
unsigned int fs;
afe_reg_update_bits(afe, irq->irq_data->irq_cnt_reg,
irq->irq_data->irq_cnt_maskbit << irq->irq_data->irq_cnt_shift,
period << irq->irq_data->irq_cnt_shift);
/* set irq fs */
fs = afe->irq_fs(rate);
if (fs < 0) <<< never true
return -EINVAL; /* set irq fs */
Filing as a bug so that MTK folks can look at it.
cppcheck reports warnings in MTK code
Looking at the code, there are multiple places with signed/unsigned confusions
Filing as a bug so that MTK folks can look at it.