Public bug reported:
[ Impact ]
The jammy linux-xilinx-zynqmp kernel fails to build after rebasing onto
Ubuntu-5.15.0-203.213:
drivers/mtd/spi-nor/swp.c: In function 'spi_nor_sr_unlock':
drivers/mtd/spi-nor/swp.c:305:29: error: 'mtd' undeclared (first use in this
function)
305 | pow = ilog2(mtd->size) - ilog2(min_prot_len) + 1;
The Xilinx patch "mtd: spi-nor: Update flash lock/unlock feature" changes
spi_nor_sr_unlock() to use ilog2(mtd->size). That relied on the local
'struct mtd_info *mtd = &nor->mtd;' declaration in that function.
The upstream stable commit pulled in via the master rebase,
6d33f8d1a629 ("mtd: spi-nor: Fix spi_nor_try_unlock_all()")
(upstream 2e3a7476ec3989e77270b9481e76e137824b17c0), removes that local
variable and switches the software write protection helpers to
nor->params->size. That is needed because mtd->size isn't set yet when
spi_nor_try_unlock_all() runs during spi_nor_scan().
The Xilinx hunk doesn't touch the declaration lines, so it still applies
cleanly, but the result no longer compiles.
[ Fix ]
Use nor->params->size instead of mtd->size in spi_nor_sr_unlock(),
consistent with the rest of swp.c after the upstream fix.
spi_nor_set_mtd_info() assigns mtd->size = nor->params->size, and
params->size already accounts for the Xilinx stacked/parallel
configurations (n_sectors and sector_size are doubled before it is
computed), so the value is unchanged once probe has finished.
[ Test Plan ]
- Build the jammy linux-xilinx-zynqmp kernel for arm64 and confirm
drivers/mtd/spi-nor/swp.c compiles.
- Boot on a ZynqMP board with QSPI NOR flash (e.g. KV260/KD240) and
confirm the flash probes and its MTD partitions are available.
- Exercise lock/unlock with flash_lock / flash_unlock on an MTD
partition and confirm both succeed and status is reported correctly.
[ Where problems could occur ]
The change only affects the size used to compute the block-protect bits
in spi_nor_sr_unlock(). If params->size differed from mtd->size, unlock
could program the wrong BP bits, leaving regions locked or unlocking
more than requested. Both values are set from the same source, so this
is not expected. The change also avoids reading mtd->size before it is
initialized during probe.
** Affects: linux-xilinx-zynqmp (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2172646
Title:
linux-xilinx-zynqmp: FTBFS in drivers/mtd/spi-nor/swp.c: 'mtd'
undeclared in spi_nor_sr_unlock(
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-xilinx-zynqmp/+bug/2172646/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
