[PATCH 06/16] md/bitmap: Return directly after a failed kzalloc() in bitmap_resize()

From: SF Markus Elfring
Date: Tue Sep 27 2016 - 12:53:40 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Sep 2016 15:21:23 +0200

* Return directly after a call of the function "kzalloc" failed here.

* Delete two assignments for the local variable "ret" and the jump
target "err" which became unnecessary with this refactoring.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/md/bitmap.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 5092bc0..2d30c83 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -2037,10 +2037,9 @@ int bitmap_resize(struct bitmap *bitmap, sector_t blocks,
pages = DIV_ROUND_UP(chunks, PAGE_COUNTER_RATIO);

new_bp = kzalloc(pages * sizeof(*new_bp), GFP_KERNEL);
- ret = -ENOMEM;
if (!new_bp) {
bitmap_file_unmap(&store);
- goto err;
+ return -ENOMEM;
}

if (!init)
@@ -2160,8 +2159,6 @@ int bitmap_resize(struct bitmap *bitmap, sector_t blocks,
bitmap_unplug(bitmap);
bitmap->mddev->pers->quiesce(bitmap->mddev, 0);
}
- ret = 0;
-err:
return ret;
}
EXPORT_SYMBOL_GPL(bitmap_resize);
--
2.10.0