[PATCH] lib: sparse: Fix error checking for write_sparse_chunk_raw