Smatch report for drivers/fpga/socfpga_gen5.c
Heinrich Schuchardt
xypron.glpk at gmx.de
Fri Jul 25 14:22:56 CEST 2025
On 25.07.25 13:09, Andrew Goodbody wrote:
> 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
As we have been running with a single iteration since 2017, probably the
for loop and the if statement relating to FPGA_TIMEOUT_CNT should be
removed.
Best regards
Heinrich
More information about the U-Boot
mailing list