Commit de749814 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Jason Gunthorpe

RDMA/uverbs: Refactor flow_resources_alloc() function

Simplify the flow_resources_alloc() function call by reducing
number of goto statements.
Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent dd8028f1
...@@ -2761,29 +2761,24 @@ static struct ib_uflow_resources *flow_resources_alloc(size_t num_specs) ...@@ -2761,29 +2761,24 @@ static struct ib_uflow_resources *flow_resources_alloc(size_t num_specs)
resources = kzalloc(sizeof(*resources), GFP_KERNEL); resources = kzalloc(sizeof(*resources), GFP_KERNEL);
if (!resources) if (!resources)
goto err_res; return NULL;
resources->counters = resources->counters =
kcalloc(num_specs, sizeof(*resources->counters), GFP_KERNEL); kcalloc(num_specs, sizeof(*resources->counters), GFP_KERNEL);
if (!resources->counters)
goto err_cnt;
resources->collection = resources->collection =
kcalloc(num_specs, sizeof(*resources->collection), GFP_KERNEL); kcalloc(num_specs, sizeof(*resources->collection), GFP_KERNEL);
if (!resources->collection) if (!resources->counters || !resources->collection)
goto err_collection; goto err;
resources->max = num_specs; resources->max = num_specs;
return resources; return resources;
err_collection: err:
kfree(resources->counters); kfree(resources->counters);
err_cnt:
kfree(resources); kfree(resources);
err_res:
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment