Smatch report for drivers/fpga/socfpga_gen5.c

Andrew Goodbody andrew.goodbody at linaro.org
Fri Jul 25 13:09:57 CEST 2025


Smatch reports this issue

drivers/fpga/socfpga_gen5.c:135 fpgamgr_program_poll_cd() warn: 
duplicate check 'reg & mask' (previous on line 129)

Looking at the code I am not sure that it will work as intended. There 
are two if statements within the for loop that test for opposite 
conditions so could easily be combined into if..else with a single test. 
But also both if statements result in the for loop being exited, and one 
of them must be satisfied so the for loop can only ever be executed 
once. This surely must not be the intention. It is not clear to me 
whether the error test is wrong and should be changed to a different 
test or it should simply be removed. Could you take a look please?

Thanks,
Andrew


More information about the U-Boot mailing list