Re: [PATCH v6 1/2] mtd: spi-nor: Delay the initialization of bank_size

Tudor Ambarus
2023-04-04T06:47:01Z

On Fri, 31 Mar 2023 21:46:19 +0200, Miquel Raynal wrote:
> Bank size is derived from the chip's size, which in
> spi_nor_init_default_params() can still be zero if the size is not
> hardcoded in a table (eg. sfdp parsing). We need to delay the
> initialization of this field in the "late" helpers.
>
> Based on the fact that RWW compatible devices will use the bank_size to
> derive in which bank an access is made, we absolutely want to avoid
> divisions by 0. Right now there is no such opportunity between
> spi_nor_init_default_params() and spi_nor_late_init_params() but it is
> probably safer to enforce a default value (assuming 1 bank) as early as
> possible, just in case some day code using this variable is moved
> earlier than expected.
>
> [...]

Applied to git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git,
spi-nor/next branch. Thanks!

[1/2] mtd: spi-nor: Delay the initialization of bank_size
https://git.kernel.org/mtd/c/79a4db50192c
[2/2] mtd: spi-nor: macronix: Add support for mx25uw51245g with RWW
https://git.kernel.org/mtd/c/f0a499acb4b6

Cheers,
--
Tudor Ambarus <tudor.ambarus@linaro.org>