[PATCH] mtd: spi-nor: Fix spi_nor_try_unlock_all()

Pratyush Yadav pratyush at kernel.org
Thu Jul 3 08:13:13 PDT 2025


On Tue, Jul 01 2025, Michael Walle wrote:

> Commit ff67592cbdfc ("mtd: spi-nor: Introduce spi_nor_set_mtd_info()")
> moved all initialization of the mtd fields at the end of spi_nor_scan().
> Normally, the mtd info is only needed for the mtd ops on the device,
> with one exception: spi_nor_try_unlock_all(), which will also make use
> of the mtd->size parameter. With that commit, the size will always be
> zero because it is not initialized. Fix that by not using the size of
> the mtd_info struct, but use the size from struct spi_nor_flash_parameter.
>
> Fixes: ff67592cbdfc ("mtd: spi-nor: Introduce spi_nor_set_mtd_info()")
> Cc: stable at vger.kernel.org
> Reported-by: Jean-Marc Ranger <jmranger at hotmail.com>
> Closes: https://lore.kernel.org/all/DM6PR06MB561177323DC5207E34AF2A06C547A@DM6PR06MB5611.namprd06.prod.outlook.com/
> Tested-by: Jean-Marc Ranger <jmranger at hotmail.com>
> Signed-off-by: Michael Walle <mwalle at kernel.org>

This patch hasn't had much time on the list but we are already at -rc4
and I want it to get some time in linux-next. If later reviews come in
and changes are needed, I can drop it and apply the new version. So
applied to spi-nor/next. Thanks!

[...]

-- 
Regards,
Pratyush Yadav



More information about the linux-mtd mailing list