提交 de749814 编写于 作者: L Leon Romanovsky 提交者: Jason Gunthorpe

RDMA/uverbs: Refactor flow_resources_alloc() function

Simplify the flow_resources_alloc() function call by reducing
number of goto statements.
Reviewed-by: NMichael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
上级 dd8028f1
......@@ -2761,29 +2761,24 @@ static struct ib_uflow_resources *flow_resources_alloc(size_t num_specs)
resources = kzalloc(sizeof(*resources), GFP_KERNEL);
if (!resources)
goto err_res;
return NULL;
resources->counters =
kcalloc(num_specs, sizeof(*resources->counters), GFP_KERNEL);
if (!resources->counters)
goto err_cnt;
resources->collection =
kcalloc(num_specs, sizeof(*resources->collection), GFP_KERNEL);
if (!resources->collection)
goto err_collection;
if (!resources->counters || !resources->collection)
goto err;
resources->max = num_specs;
return resources;
err_collection:
err:
kfree(resources->counters);
err_cnt:
kfree(resources);
err_res:
return NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册