Smatch issues reported for Marvell a38x DDR4

Andrew Goodbody andrew.goodbody at linaro.org
Mon Jul 28 16:25:42 CEST 2025


On 25/07/2025 14:02, Stefan Roese wrote:
> Hi Andrew,
> 
> On 24.07.25 18:01, Andrew Goodbody wrote:
>> Hi Stefan,
>>
>> Smatch reports the following issues
>>
>> drivers/ddr/marvell/a38x/mv_ddr4_training_calibration.c:1029 
>> mv_ddr4_center_of_mass_calc() warn: unsigned 'd_min' is never less 
>> than zero.
>> drivers/ddr/marvell/a38x/mv_ddr4_training_calibration.c:2192 
>> mv_ddr4_dm_tuning() warn: unsigned 'reg_val' is never less than zero.
>> drivers/ddr/marvell/a38x/mv_ddr4_training_calibration.c:2270 
>> mv_ddr4_dm_tuning() warn: unsigned 'reg_val' is never less than zero.
>> drivers/ddr/marvell/a38x/mv_ddr4_training_calibration.c:662 
>> mv_ddr4_centralization() warn: unsigned 'if_id' is never less than zero.
>> drivers/ddr/marvell/a38x/mv_ddr4_training_calibration.c:662 
>> mv_ddr4_centralization() warn: we never enter this loop
>> drivers/ddr/marvell/a38x/mv_ddr4_training_calibration.c:911 
>> mv_ddr4_dqs_reposition() warn: always true condition '(delta >= 0) => 
>> (0-255 >= 0)'
>> drivers/ddr/marvell/a38x/mv_ddr4_training_calibration.c:924 
>> mv_ddr4_dqs_reposition() warn: unsigned 'delta' is never less than zero.
>>
>> As I have no way to validate the correctness of the code I am not 
>> confident enough to attempt to make the appropriate fixes in this case 
>> as it could affect its operation. Perhaps you would like to take a look?
> 
> Sure, thanks for all your work on these smatch issues. Really
> appreciated.
> 
> But frankly, it's not easy to test anything in this area. I still have
> access to one board (AFAIK), but minor changes usually don't really
> make a notable difference in the DDR controller configuration here.
> 
> My suggestion is to send the patches (or one patch) "as best as you can"
> to the list for official review. I'll try to review and perhaps someone
> else with access to such a board will take a look.
> 
> Thanks,
> Stefan

OK, patch coming. It was not as invasive as I feared.

Andrew


More information about the U-Boot mailing list