diff options
-rw-r--r-- | drivers/mtd/ubi/vtbl.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index b6fd6bbd941e..83236c31c892 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c | |||
@@ -317,14 +317,13 @@ retry: | |||
317 | return err; | 317 | return err; |
318 | 318 | ||
319 | write_error: | 319 | write_error: |
320 | kfree(new_seb); | 320 | /* Maybe this physical eraseblock went bad, try to pick another one */ |
321 | /* May be this physical eraseblock went bad, try to pick another one */ | 321 | if (++tries <= 5) |
322 | if (++tries <= 5) { | ||
323 | err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec, | 322 | err = ubi_scan_add_to_list(si, new_seb->pnum, new_seb->ec, |
324 | &si->corr); | 323 | &si->corr); |
325 | if (!err) | 324 | kfree(new_seb); |
326 | goto retry; | 325 | if (!err) |
327 | } | 326 | goto retry; |
328 | out_free: | 327 | out_free: |
329 | ubi_free_vid_hdr(ubi, vid_hdr); | 328 | ubi_free_vid_hdr(ubi, vid_hdr); |
330 | return err; | 329 | return err; |