[PATCH 1/2] mtdpart: Avoid divide-by-zero on out-of-reach path

Jörn Engel joern at logfs.org
Tue Jun 17 11:39:43 EDT 2008

On Tue, 17 June 2008 17:29:32 +0200, Jörn Engel wrote:
> In other words, I am tempted to replace all that with a single line:
> 	BUG();

Or maybe combine it with the else path:
	slave->mtd.erasesize = master->erasesize;
	if (master->numeraseregions > 1)
		printk(KERN_ERR"mtdpart can not handle multiple eraseregions correctly.\n");

Nemoto-san, would this be good enough for you?  It fixes the bug you
noticed, it removes most long lines and it removes the sparse warning.
It also removes functionality that may have been useful to some person -
detecting a smaller erasesize.  And with some luck and a warm easterly
wind, that functionality may even have worked.


Maintenance in other professions and of other articles is concerned with
the return of the item to its original state; in Software, maintenance
is concerned with moving an item away from its original state.
-- Les Belady

More information about the linux-mtd mailing list