Re: [PATCH v1] mtd: parsers: ofpart: Fix parsing when size-cells is 0

Miquel Raynal
2023-01-05T21:02:19Z

marex@denx.de wrote on Thu, 5 Jan 2023 15:51:10 +0100:

> On 1/5/23 13:47, Francesco Dolcini wrote:
> > Hello Miquel,
>
> Hi,
>
> [...]
>
> >> Let's move forward with this. Let's assume my fears are baseless. We
> >> might consider the situation where someone tries to hide the partitions
> >> by setting #size-cell to 0 even wronger and too unlikely. Hopefully we
> >> will not break any other existing setups by applying an always-on fix.
> >
> > Nice, good!
>
> Indeed
>
> >> I would still like to see U-Boot partitions handling evolve, at least:
> >> - fix #size-cells in fdt_fixup_mtd()
> >> - avoid the fdt_fixup_mtd() call from Collibri boards (ie. an example
> >> that can be followed by the other users)
> >
> > Fine, I can do it.
> >
> > However I am just not 100% sure about your proposal, I wonder if we
> > should just deprecate this function or we should fix it.
>
> I would say fix it.

Well, I think these are two orthogonal changes. The function should be
deprecated *and* fixed for the existing users?

> > The exact end result will depend on the discussion with the U-Boot
> > folks, but I absolutely agree that the current situation needs to
> > change. I'll keep you in CC on those patches.
> >
> >> On Linux side let's fix #size-cells like you proposed without filtering
> >> against a list of compatibles. We however need to improve the
> >> heuristics:
> >> - Do it only when there are partitions declared within a NAND
> >> controller node.
> >> - Change the warning to avoid mentioning backward compatibility, just
> >> mention this is utterly wrong and thus the value will be set to 1
> >> instead of 0.
> >> - Mention in the comment above this only works on systems with <4GiB
> >> chips.
> >> If you think about other conditions please feel free to add them.
> >>
> >> Do you concur?
> > Yes, I do agree.
>
> Same here, agreed, thanks.
>
> [...]

Thanks,
Miquèl