ubi: Fix broken cleanup code in attach_by_scanning
The unwind code was not reversing operations correctly and was causing a hang on any error condition. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
3d38910151
commit
76c1637e95
|
|
@ -478,19 +478,19 @@ static int attach_by_scanning(struct ubi_device *ubi)
|
||||||
|
|
||||||
err = ubi_eba_init_scan(ubi, si);
|
err = ubi_eba_init_scan(ubi, si);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_wl;
|
goto out_vtbl;
|
||||||
|
|
||||||
err = ubi_wl_init_scan(ubi, si);
|
err = ubi_wl_init_scan(ubi, si);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_vtbl;
|
goto out_eba;
|
||||||
|
|
||||||
ubi_scan_destroy_si(si);
|
ubi_scan_destroy_si(si);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
out_eba:
|
||||||
|
ubi_eba_close(ubi);
|
||||||
out_vtbl:
|
out_vtbl:
|
||||||
vfree(ubi->vtbl);
|
vfree(ubi->vtbl);
|
||||||
out_wl:
|
|
||||||
ubi_wl_close(ubi);
|
|
||||||
out_si:
|
out_si:
|
||||||
ubi_scan_destroy_si(si);
|
ubi_scan_destroy_si(si);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -1538,6 +1538,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_scan_info *si)
|
||||||
if (ubi->avail_pebs < WL_RESERVED_PEBS) {
|
if (ubi->avail_pebs < WL_RESERVED_PEBS) {
|
||||||
ubi_err("no enough physical eraseblocks (%d, need %d)",
|
ubi_err("no enough physical eraseblocks (%d, need %d)",
|
||||||
ubi->avail_pebs, WL_RESERVED_PEBS);
|
ubi->avail_pebs, WL_RESERVED_PEBS);
|
||||||
|
err = -ENOSPC;
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
ubi->avail_pebs -= WL_RESERVED_PEBS;
|
ubi->avail_pebs -= WL_RESERVED_PEBS;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue