[PATCH 2/2] ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1

Richard Weinberger richard at nod.at
Mon Jul 25 03:31:39 PDT 2016


Rajeev,

Am 25.07.2016 um 11:46 schrieb Rajeev Kumar:
> If the master mtd does not have any slave mtd partitions,
> and its numeraseregions is one(only has one erease block), and
> we attach the master mtd with : ubiattach -m 0 -d 0
> 
> We will meet the error:
> -------------------------------------------------------
> root ~$ ubiattach /dev/ubi_ctrl -m 0 -d 0
> UBI: attaching mtd0 to ubi0
> UBI error: io_init: multiple regions, not implemented
> ubiattach: error!: cannot attach mtd0
>            error 22 (Invalid argument)
> -------------------------------------------------------
> 
> In fact, if there is only one "erase block", we should not
> prevent the attach.
> 
> This patch is tested against 3.14 kernel and only build test is
> performed against current upstream master branch.

The more interesting question is, why is ->numeraseregions not 0?

The comment in the header says:
        /* Data for variable erase regions. If numeraseregions is zero,
         * it means that the whole device has erasesize as given above.
         */

So, if your MTD erase regions with the same size, it should be 0.

IIRC we had such a discussion already on linux-mtd and it was not clear
whether numeraseregions of 0 and 1 are equal or not.

Thanks,
//richard



More information about the linux-mtd mailing list