read_exception() and write_exception() only currently return an error code when supplied with an out-of-range index. Since this should only ever occur as a result of a bug in the calling code, we should handle this case with an assertion and remove the need for error handling in callers. Index: linux-2.6.16.i686/drivers/md/dm-exception-store.c =================================================================== --- linux-2.6.16.i686.orig/drivers/md/dm-exception-store.c 2006-04-14 12:27:42.000000000 -0400 +++ linux-2.6.16.i686/drivers/md/dm-exception-store.c 2006-04-14 12:53:12.000000000 -0400 @@ -295,42 +295,33 @@ static int write_header(struct pstore *p */ static struct disk_exception *get_exception(struct pstore *ps, uint32_t index) { - if (index >= ps->exceptions_per_area) - return NULL; + BUG_ON(index >= ps->exceptions_per_area); return ((struct disk_exception *) ps->area) + index; } -static int read_exception(struct pstore *ps, - uint32_t index, struct disk_exception *result) +static void read_exception(struct pstore *ps, + uint32_t index, struct disk_exception *result) { struct disk_exception *e; e = get_exception(ps, index); - if (!e) - return -EINVAL; /* copy it */ result->old_chunk = le64_to_cpu(e->old_chunk); result->new_chunk = le64_to_cpu(e->new_chunk); - - return 0; } -static int write_exception(struct pstore *ps, - uint32_t index, struct disk_exception *de) +static void write_exception(struct pstore *ps, + uint32_t index, struct disk_exception *de) { struct disk_exception *e; e = get_exception(ps, index); - if (!e) - return -EINVAL; /* copy it */ e->old_chunk = cpu_to_le64(de->old_chunk); e->new_chunk = cpu_to_le64(de->new_chunk); - - return 0; } /* @@ -348,10 +339,7 @@ static int insert_exceptions(struct psto *full = 1; for (i = 0; i < ps->exceptions_per_area; i++) { - r = read_exception(ps, i, &de); - - if (r) - return r; + read_exception(ps, i, &de); /* * If the new_chunk is pointing at the start of