diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-03-18 22:14:12 +0300 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2022-03-18 22:14:42 +0300 |
commit | 4e371d996590f3a7e82a086d499c912c1930e968 (patch) | |
tree | 0c7b300670901f498238b32e59c307eddf338489 /drivers/mtd/devices | |
parent | 8f877b7eab9d60a9deef6beae95656b77d55ab75 (diff) | |
parent | 151c6b49d679872d6fc0b50e0ad96303091694a2 (diff) | |
download | linux-4e371d996590f3a7e82a086d499c912c1930e968.tar.xz |
Merge tag 'spi-nor/for-5.18' into mtd/next
SPI NOR core changes:
- move vendor specific code out of the core into vendor drivers.
- unify all function and object names in the vendor modules.
- make setup() callback optional to improve readability.
- skip erase logic when the SPI_NOR_NO_ERASE flag is set at flash
declaration.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/devices')
-rw-r--r-- | drivers/mtd/devices/phram.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 6ed6c51fac69..d503821a3e60 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c @@ -264,16 +264,20 @@ static int phram_setup(const char *val) } } - if (erasesize) - div_u64_rem(len, (uint32_t)erasesize, &rem); - if (len == 0 || erasesize == 0 || erasesize > len - || erasesize > UINT_MAX || rem) { + || erasesize > UINT_MAX) { parse_err("illegal erasesize or len\n"); ret = -EINVAL; goto error; } + div_u64_rem(len, (uint32_t)erasesize, &rem); + if (rem) { + parse_err("len is not multiple of erasesize\n"); + ret = -EINVAL; + goto error; + } + ret = register_device(name, start, len, (uint32_t)erasesize); if (ret) goto error; |