Remove useless ti->error for ENOMEM. ENOMEM is ENOMEM
and it's enought. Group allocations together.

Signed-off-by: Kirill Tkhai <[email protected]>
---
 drivers/md/dm-ploop-target.c |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 5af682dc2ea4..71bda7026482 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -286,10 +286,8 @@ static int ploop_ctr(struct dm_target *ti, unsigned int 
argc, char **argv)
                return -EINVAL;
 
        ploop = kzalloc(sizeof(*ploop), GFP_KERNEL);
-       if (!ploop) {
-               ti->error = "Error allocating ploop structure";
+       if (!ploop)
                return -ENOMEM;
-       }
 
        ploop->exclusive_pios = kcalloc(PLOOP_HASH_TABLE_SIZE,
                                        sizeof(struct hlist_head),
@@ -324,11 +322,16 @@ static int ploop_ctr(struct dm_target *ti, unsigned int 
argc, char **argv)
                if (percpu_ref_init(&ploop->inflight_bios_ref[i], release,
                                    PERCPU_REF_ALLOW_REINIT, GFP_KERNEL)) {
                        ret = -ENOMEM;
-                       ti->error = "could not alloc percpu_ref";
                        goto err;
                }
        }
 
+       ploop->wq = alloc_ordered_workqueue("dm-" DM_MSG_PREFIX, 
WQ_MEM_RECLAIM);
+       if (!ploop->wq) {
+               ret = -ENOMEM;
+               goto err;
+       }
+
        ti->private = ploop;
        ploop->ti = ti;
 
@@ -343,13 +346,6 @@ static int ploop_ctr(struct dm_target *ti, unsigned int 
argc, char **argv)
                goto err;
        }
 
-       ploop->wq = alloc_ordered_workqueue("dm-" DM_MSG_PREFIX, 
WQ_MEM_RECLAIM);
-       if (!ploop->wq) {
-               ti->error = "could not create workqueue for metadata object";
-               ret = -ENOMEM;
-               goto err;
-       }
-
        ret = ploop_add_deltas_stack(ploop, &argv[1], argc - 1);
        if (ret)
                goto err;


_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to