determining if a block erasure failed

From: Joel Reardon
Date: Tue May 15 2012 - 03:53:37 EST

I want the caller of erase_worker() to be aware if the erase block became
bad. Here is the relevant code at the end of erase_worker():

/* at this time, the erase has failed. err == -EIO */
ubi_msg("mark PEB %d as bad", pnum);
err = ubi_io_mark_bad(ubi, pnum);
if (err)
goto out_ro;

/* does other stuff, not touching err */

/* err == 0 here, because of above goto */
return err;

return err;

So, if this function should return zero when the erase block fails, then I
will add a "result" field to ubi_work that will store the result of the
work function. But I figured I'd check first if the return err that always
returns 0 is not an oversight and this function should return -EIO if it

Joel Reardon

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at