Smatch issues reported for Marvell a38x DDR4

Tony Dinh mibodhi at gmail.com
Tue Aug 5 19:45:38 CEST 2025


Hi Stefan,

On Tue, Aug 5, 2025 at 9:08 PM Stefan Roese <stefan.roese at mailbox.org> wrote:
>
> Hi Tony,
>
> On 05.08.25 15:11, Tony Dinh wrote:
> > Hi Andrew,
> >
> > On Mon, Jul 28, 2025 at 9:25 PM Andrew Goodbody
> > <andrew.goodbody at linaro.org> wrote:
> >>
> >> 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.
> >>
> >
> > Please add me to the CC list of your patches. I'll be available (in a
> > couple weeks) to run regression tests for this Armada 38x DDR4 area.
>
> The (one) patch is already in master. It would be great though, if you
> could run some regression tests once time permits though.

Ah, I see that patch has covered all the error cases. Will do the
regression test.

All the best,
Tony

>
> Thanks,
> Stefan
>


More information about the U-Boot mailing list