lkml.org 
[lkml]   [2023]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectlinux-6.5/sound/soc/codecs/rt722-sdca.c:612: some confused logic ?
Date
Hello there,

I just ran cppcheck over the source code of linux-6.5. It said:

linux-6.5/sound/soc/codecs/rt722-sdca.c:612:8: style: Expression is always true because 'else if' condition is opposite to previous condition at line 609. [multiCondition]

Source code is

if (!adc_vol_flag) /* boost gain */
ctl = regvalue / boost_step;
else { /* ADC gain */
if (adc_vol_flag)
ctl = p->max - (((vol_max - regvalue) & 0xffff) / interval_offset);
else
ctl = p->max - (((0 - regvalue) & 0xffff) / interval_offset);
}

This code might benefit from some rework.

Regards

David Binderman

\
 
 \ /
  Last update: 2023-08-31 13:09    [W:0.094 / U:1.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site