All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabio Estevam <festevam@gmail.com>
To: david.oberhollenzer@sigma-star.at, Richard Weinberger <richard@nod.at>
Cc: linux-mtd <linux-mtd@lists.infradead.org>,
	 Miquel Raynal <miquel.raynal@bootlin.com>,
	Marek Vasut <marex@denx.de>, Heiko Schocher <hs@denx.de>
Subject: mtd-utils: Proper way to handle erasize=0
Date: Mon, 19 Jul 2021 16:12:26 -0300	[thread overview]
Message-ID: <CAOMZO5BX9iYmZwBBGEstbcWpvftRNExtwq+kX_rQff0v_o1P5g@mail.gmail.com> (raw)

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/

             reply	other threads:[~2021-07-19 19:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 19:12 Fabio Estevam [this message]
2021-07-19 19:36 ` mtd-utils: Proper way to handle erasize=0 Richard Weinberger
2021-07-19 22:20   ` Fabio Estevam
2021-07-19 22:33     ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOMZO5BX9iYmZwBBGEstbcWpvftRNExtwq+kX_rQff0v_o1P5g@mail.gmail.com \
    --to=festevam@gmail.com \
    --cc=david.oberhollenzer@sigma-star.at \
    --cc=hs@denx.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marex@denx.de \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.