mtd: return EOPNOTSUPP when attempting to erase an MTD_NO_ERASE device
At least some MTD_NO_ERASE devices like MRAM do not specify a sensible
erase block size; instead, erasesize is equal to the whole flash size. This
leads to an EINVAL return from mtd_erase_align() whenever a partial erase
is attempted.

At least on the MRAM I tested, a full flash erase did not return an error,
but it did not have any effect on the flash either. As erase seems to be
entirely unsupported on this class of devices, and it is not necessary
anyways, it's better to return early with EOPNOTSUPP.

This fixes envfs_save() on a partitioned MRAM.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 1bce5f3 commit b5ef34499a3064680918d91ecdea74ddcf98716e
@Matthias Schiffer Matthias Schiffer authored on 23 Nov 2018
Sascha Hauer committed on 26 Nov 2018
Showing 1 changed file
View
drivers/mtd/core.c