| .. | .. |
|---|
| 947 | 947 | int offset, int len) |
|---|
| 948 | 948 | { |
|---|
| 949 | 949 | struct ubi_device *ubi = vol->ubi; |
|---|
| 950 | | - int pnum, opnum, err, vol_id = vol->vol_id; |
|---|
| 950 | + int pnum, opnum, err, err2, vol_id = vol->vol_id; |
|---|
| 951 | 951 | |
|---|
| 952 | 952 | pnum = ubi_wl_get_peb(ubi); |
|---|
| 953 | 953 | if (pnum < 0) { |
|---|
| .. | .. |
|---|
| 982 | 982 | out_put: |
|---|
| 983 | 983 | up_read(&ubi->fm_eba_sem); |
|---|
| 984 | 984 | |
|---|
| 985 | | - if (err && pnum >= 0) |
|---|
| 986 | | - err = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1); |
|---|
| 987 | | - else if (!err && opnum >= 0) |
|---|
| 988 | | - err = ubi_wl_put_peb(ubi, vol_id, lnum, opnum, 0); |
|---|
| 985 | + if (err && pnum >= 0) { |
|---|
| 986 | + err2 = ubi_wl_put_peb(ubi, vol_id, lnum, pnum, 1); |
|---|
| 987 | + if (err2) { |
|---|
| 988 | + ubi_warn(ubi, "failed to return physical eraseblock %d, error %d", |
|---|
| 989 | + pnum, err2); |
|---|
| 990 | + } |
|---|
| 991 | + } else if (!err && opnum >= 0) { |
|---|
| 992 | + err2 = ubi_wl_put_peb(ubi, vol_id, lnum, opnum, 0); |
|---|
| 993 | + if (err2) { |
|---|
| 994 | + ubi_warn(ubi, "failed to return physical eraseblock %d, error %d", |
|---|
| 995 | + opnum, err2); |
|---|
| 996 | + } |
|---|
| 997 | + } |
|---|
| 989 | 998 | |
|---|
| 990 | 999 | return err; |
|---|
| 991 | 1000 | } |
|---|