* mtd-utils: Proper way to handle erasize=0
@ 2021-07-19 19:12 Fabio Estevam
2021-07-19 19:36 ` Richard Weinberger
0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2021-07-19 19:12 UTC (permalink / raw)
To: david.oberhollenzer, Richard Weinberger
Cc: linux-mtd, Miquel Raynal, Marek Vasut, Heiko Schocher
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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mtd-utils: Proper way to handle erasize=0
2021-07-19 19:12 mtd-utils: Proper way to handle erasize=0 Fabio Estevam
@ 2021-07-19 19:36 ` Richard Weinberger
2021-07-19 22:20 ` Fabio Estevam
0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2021-07-19 19:36 UTC (permalink / raw)
To: festevam; +Cc: david oberhollenzer, linux-mtd, Miquel Raynal, Marek Vasut, hs
----- Ursprüngliche Mail -----
> Von: "festevam" <festevam@gmail.com>
> An: "david oberhollenzer" <david.oberhollenzer@sigma-star.at>, "richard" <richard@nod.at>
> CC: "linux-mtd" <linux-mtd@lists.infradead.org>, "Miquel Raynal" <miquel.raynal@bootlin.com>, "Marek Vasut"
> <marex@denx.de>, "hs" <hs@denx.de>
> Gesendet: Montag, 19. Juli 2021 21:12:26
> Betreff: mtd-utils: Proper way to handle erasize=0
> 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?
Didn't this commit address that problem?
commit 54d68799b73e755923def1306b4da607ad45bd60
Author: Chris Packham <chris.packham@alliedtelesis.co.nz>
Date: Fri Nov 27 13:07:08 2020 +1300
libmtd: avoid divide by zero
The concept of erase blocks doesn't apply to mtd-ram devices. Such
devices set MTD_NO_ERASE to indicate this and some report 0 for the
erase block size. Avoid a divide by zero when calculating the erase
block count for such devices.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mtd-utils: Proper way to handle erasize=0
2021-07-19 19:36 ` Richard Weinberger
@ 2021-07-19 22:20 ` Fabio Estevam
2021-07-19 22:33 ` Richard Weinberger
0 siblings, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2021-07-19 22:20 UTC (permalink / raw)
To: Richard Weinberger
Cc: david oberhollenzer, linux-mtd, Miquel Raynal, Marek Vasut, hs
Hi Richard,
On Mon, Jul 19, 2021 at 4:36 PM Richard Weinberger <richard@nod.at> wrote:
> Didn't this commit address that problem?
Ah, thanks for pointing that out. This should fix it.
OpenEmbedded is pulling mtd-utils 2.1.2, where this commit is not present.
Maybe it is time to release 2.1.3? :-)
Thanks
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mtd-utils: Proper way to handle erasize=0
2021-07-19 22:20 ` Fabio Estevam
@ 2021-07-19 22:33 ` Richard Weinberger
0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2021-07-19 22:33 UTC (permalink / raw)
To: festevam; +Cc: david oberhollenzer, linux-mtd, Miquel Raynal, Marek Vasut, hs
----- Ursprüngliche Mail -----
> On Mon, Jul 19, 2021 at 4:36 PM Richard Weinberger <richard@nod.at> wrote:
>
>> Didn't this commit address that problem?
>
> Ah, thanks for pointing that out. This should fix it.
>
> OpenEmbedded is pulling mtd-utils 2.1.2, where this commit is not present.
>
> Maybe it is time to release 2.1.3? :-)
/me eyes David. ;)
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-19 22:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 19:12 mtd-utils: Proper way to handle erasize=0 Fabio Estevam
2021-07-19 19:36 ` Richard Weinberger
2021-07-19 22:20 ` Fabio Estevam
2021-07-19 22:33 ` Richard Weinberger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.