mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-24 14:25:56 +00:00
cmd: ubi.c: skip part command if right partition is already attached
Attaching a UBI partition may take a while, since scanning the memory is required. It thus makes sense to avoid a detach/scan/attach cycle when the right partition is already attached, and let the calling process call 'detach' beforehand if it needs it. This commit checks for the currently attached UBI partition, and skips reattaching if not needed, showing an information. Signed-off-by: Alexandre Besnard <alexandre.besnard@softathome.com>
This commit is contained in:
parent
72675b063b
commit
af298f3dcd
1 changed files with 5 additions and 0 deletions
|
@ -511,6 +511,11 @@ int ubi_part(char *part_name, const char *vid_header_offset)
|
|||
struct mtd_info *mtd;
|
||||
int err = 0;
|
||||
|
||||
if (ubi && ubi->mtd && !strcmp(ubi->mtd->name, part_name)) {
|
||||
printf("UBI partition '%s' already selected\n", part_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ubi_detach();
|
||||
|
||||
mtd_probe_devices();
|
||||
|
|
Loading…
Add table
Reference in a new issue