[PATCH 31/47] block-rbd: Fix three jump targets in rbd_img_obj_parent_read_full()
From: SF Markus Elfring
Date: Mon Sep 12 2016 - 15:19:21 EST
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Sep 2016 19:48:46 +0200
* Adjust jump targets according to the current Linux coding
style convention.
* Delete two duplicate checks then at the end.
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
I find that this function implementation needs another close look.
It seems that four lines can not be executed according to the shown
control flow at the moment.
How do you think about to avoid "dead" source code there anyhow?
drivers/block/rbd.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 7d5f7b9..1b8a8c5 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2789,18 +2789,18 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
if (IS_ERR(pages)) {
result = PTR_ERR(pages);
pages = NULL;
- goto out_err;
+ goto status_indication;
}
result = -ENOMEM;
parent_request = rbd_parent_request_create(obj_request,
img_offset, length);
if (!parent_request)
- goto out_err;
+ goto release_page_vector;
result = rbd_img_request_fill(parent_request, OBJ_REQUEST_PAGES, pages);
if (result)
- goto out_err;
+ goto put_request;
parent_request->copyup_pages = pages;
parent_request->copyup_page_count = page_count;
@@ -2813,11 +2813,11 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
parent_request->copyup_page_count = 0;
parent_request->obj_request = NULL;
rbd_obj_request_put(obj_request);
-out_err:
- if (pages)
- ceph_release_page_vector(pages, page_count);
- if (parent_request)
- rbd_img_request_put(parent_request);
+ put_request:
+ rbd_img_request_put(parent_request);
+ release_page_vector:
+ ceph_release_page_vector(pages, page_count);
+ status_indication:
obj_request->result = result;
obj_request->xferred = 0;
obj_request_done_set(obj_request);
--
2.10.0