Re: [PATCH] mtd: implement proper partition handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 11 Dec 2018 18:43:02 +0100
Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:

>  /* Returns the size of the entire flash chip */
>  uint64_t mtd_get_device_size(const struct mtd_info *mtd)
>  {
>  	if (!mtd_is_partition(mtd))
>  		return mtd->size;
>  
> -	return mtd_get_device_size(mtd_to_part(mtd)->parent);
> +	return mtd_get_device_size(mtd->parent);

Not really related to the patch, but this function only works if you
have a single level of partitioning. If we want it to work for
recursive partitioning we should have something like this:

u64 mtd_get_device_size(const struct mtd_info *mtd)
{
	while (mtd->parent)
		mtd = mtd->parent;

	return mtd->size;
}


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux