mtd-utils: Proper way to handle erasize=0

Fabio Estevam festevam at gmail.com
Mon Jul 19 12:12:26 PDT 2021


Hi,

When using a Microchip 48l640 SRAM (drivers/mtd/devices/mchp48l640.c)
the reported erasesize is 0:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00002000 00000000 "spi0.0"

This causes a division by zero at libmtd.c, as mtd_get_dev_info1() has:

mtd->eb_cnt = mtd->size / mtd->eb_size;

What would be the appropriate way to fix this?

Thanks,

Fabio Estevam



More information about the linux-mtd mailing list