Why are there 2 oobinfos for a NAND mtd?
There are both mtd->oobinfo and
((struct nand_chip *)mtd->priv)->autooob.
There's even a memcpy from one to the other. If they're supposed to be the same all the time, surely there should only be one of these?
They both get used in nand_base, which is perhaps wrong. For example, nand_read_ecc() uses mtd->oobinfo and nand_do_read_ecc() uses the other one.
Having two gets confusing and I have seen drivers where one has been hacked one but not the other which has lead to inconsistencies and faailures.
Is there any valid reason to have two?
-- Charles
Quoted 6 lines · Charles Manning
There are both
mtd->oobinfoand
((structnand_chip*)mtd->priv)->autooob.There's even a memcpy from one to the other. If they're supposed to be the same all the time, surely there should only be one of these?
Quoted 7 lines
They both get used in
nand_base, which is perhaps wrong. For example,nand_read_ecc()usesmtd->oobinfoandnand_do_read_ecc()uses the other one.Having two gets confusing and I have seen drivers where one has been hacked one but not the other which has lead to inconsistencies and faailures.
Is there any valid reason to have two?
I have no idea, but I do know that Thomas plans for some oob cleanup soon. Perhaps this is on his list.
josh