[U-Boot] [PATCH v6 31/31] cmd: ubi: clean the partition handling

Boris Brezillon boris.brezillon at bootlin.com
Thu Aug 16 19:17:15 UTC 2018


On Thu, 16 Aug 2018 17:30:29 +0200
Miquel Raynal <miquel.raynal at bootlin.com> wrote:

>  
>  int ubi_part(char *part_name, const char *vid_header_offset)
>  {
> +	struct mtd_info *mtd;
>  	int err = 0;
> -	char mtd_dev[16];
> -	struct mtd_device *dev;
> -	struct part_info *part;
> -	u8 pnum;
>  
>  	ubi_detach();
> -	/*
> -	 * Search the mtd device number where this partition
> -	 * is located
> -	 */
> -	if (find_dev_and_part(part_name, &dev, &pnum, &part)) {
> +
> +	mtd_probe_devices();

This function is only available if CONFIG_CMD_MTD=y, and you didn't
add the dependency on CMD_MTD. Anyway, as said earlier, I think this
function should be moved out of cmd/mtd.c.

> +	mtd = get_mtd_device_nm(part_name);
> +	if (IS_ERR(mtd)) {
>  		printf("Partition %s not found!\n", part_name);
>  		return 1;
>  	}



More information about the U-Boot mailing list