mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-01-27 17:37:22 +01:00
ipq806x: Detach ubi on ubi volume read error.
Detach the ubi and the associated mtd device on error conditions. Change-Id: I7b1fc798b5e03e4b2a39370697a4615139273c15 Signed-off-by: Aditya Kumar Patra S <apatr@codeaurora.org>
This commit is contained in:
parent
9349111a4c
commit
b55f8a1e4c
1 changed files with 7 additions and 1 deletions
|
|
@ -524,6 +524,7 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||
{
|
||||
int64_t size = 0;
|
||||
ulong addr = 0;
|
||||
int err = 0;
|
||||
|
||||
if (argc < 2)
|
||||
return CMD_RET_USAGE;
|
||||
|
|
@ -661,7 +662,12 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||
printf("Read %lld bytes from volume %s to %lx\n", size,
|
||||
argv[3], addr);
|
||||
|
||||
return ubi_volume_read(argv[3], (char *)addr, size);
|
||||
err = ubi_volume_read(argv[3], (char *)addr, size);
|
||||
if (err != 0) {
|
||||
ubi_detach_mtd_dev(ubi_dev.nr, 1);
|
||||
put_mtd_device(ubi_dev.mtd_info);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue