md: md_clear_badblocks should return an error code on failure.
authorNeilBrown <[email protected]>
Wed, 28 May 2014 03:39:22 +0000 (13:39 +1000)
committerNeilBrown <[email protected]>
Thu, 29 May 2014 06:59:46 +0000 (16:59 +1000)
Julia Lawall and coccinelle report that md_clear_badblocks always
returns 0, despite appearing to have an error path.
The error path really should return an error code.  ENOSPC is
reasonably appropriate.

Reported-by: Julia Lawall <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
drivers/md/md.c

index 0ddf38988fbc89b5b23225e3394d322e67850b7c..34846856dbc6106c95b81d948a4e41ad6e4d816d 100644 (file)
@@ -8343,7 +8343,7 @@ static int md_clear_badblocks(struct badblocks *bb, sector_t s, int sectors)
                        if (a < s) {
                                /* we need to split this range */
                                if (bb->count >= MD_MAX_BADBLOCKS) {
-                                       rv = 0;
+                                       rv = -ENOSPC;
                                        goto out;
                                }
                                memmove(p+lo+1, p+lo, (bb->count - lo) * 8);