diff options
| author | 2026-09-04 19:18:55 +0200 | |
|---|---|---|
| committer | 2026-09-07 09:45:05 +0200 | |
| commit | 0fb499b527cdcdb87188fbe54684e258bb98b9f1 (patch) | |
| tree | 8f321fb943977258a2513eb72b4bfc0092b1ff9d /scripts/Makefile.thinlto | |
| parent | mtd: spi-nor: Fix spacing in function call (diff) | |
mtd: spi-nor: Garbage collection during sfdp parsing
SFDP parsing works as follows:
1- The header is read then parsed
2- If correct, the sfdp structure and the sfdp content table are
allocated then filled
3- The mandatory BFPT table is parsed
4- The optional tables are then parsed as well
Any failure in steps 1-3 leads to an error and an early return. The
failure is not always fatal though, since the deprecated will fallback
to the non SFDP definition (in the ID table, for legacy chips). In this
case, the devm_ memory allocations for the SFDP table structure and
table will remain in memory for the lifetime of the device but will
never ever be accessed anymore (since they are incorrect). In this case,
we shall free the memory manually since the device is not going out of
scope anytime soon.
The assignation of nor->sfdp is also cleared in case of failure, to
avoid carrying a dangling pointer upon partial failure. This is
particularly important since the presence of valid SFDP support is
checked using the following condition: `if (!nor->sfdp)`.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Michael Walle <mwalle@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
