提交 b41bb28b 编写于 作者: A Anju T Sudhakar 提交者: Michael Ellerman

powerpc/perf: Replace the direct return with goto statement

Replace the direct return statement in imc_mem_init() with goto, to adhere
to the kernel coding style.
Signed-off-by: NAnju T Sudhakar <anju@linux.vnet.ibm.com>
Reviewed-by: NMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 cb094fa5
...@@ -1236,7 +1236,7 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent, ...@@ -1236,7 +1236,7 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
int pmu_index) int pmu_index)
{ {
const char *s; const char *s;
int nr_cores, cpu, res; int nr_cores, cpu, res = -ENOMEM;
if (of_property_read_string(parent, "name", &s)) if (of_property_read_string(parent, "name", &s))
return -ENODEV; return -ENODEV;
...@@ -1246,7 +1246,7 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent, ...@@ -1246,7 +1246,7 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
/* Update the pmu name */ /* Update the pmu name */
pmu_ptr->pmu.name = kasprintf(GFP_KERNEL, "%s%s_imc", "nest_", s); pmu_ptr->pmu.name = kasprintf(GFP_KERNEL, "%s%s_imc", "nest_", s);
if (!pmu_ptr->pmu.name) if (!pmu_ptr->pmu.name)
return -ENOMEM; goto err;
/* Needed for hotplug/migration */ /* Needed for hotplug/migration */
if (!per_nest_pmu_arr) { if (!per_nest_pmu_arr) {
...@@ -1254,7 +1254,7 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent, ...@@ -1254,7 +1254,7 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
sizeof(struct imc_pmu *), sizeof(struct imc_pmu *),
GFP_KERNEL); GFP_KERNEL);
if (!per_nest_pmu_arr) if (!per_nest_pmu_arr)
return -ENOMEM; goto err;
} }
per_nest_pmu_arr[pmu_index] = pmu_ptr; per_nest_pmu_arr[pmu_index] = pmu_ptr;
break; break;
...@@ -1262,21 +1262,21 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent, ...@@ -1262,21 +1262,21 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
/* Update the pmu name */ /* Update the pmu name */
pmu_ptr->pmu.name = kasprintf(GFP_KERNEL, "%s%s", s, "_imc"); pmu_ptr->pmu.name = kasprintf(GFP_KERNEL, "%s%s", s, "_imc");
if (!pmu_ptr->pmu.name) if (!pmu_ptr->pmu.name)
return -ENOMEM; goto err;
nr_cores = DIV_ROUND_UP(num_possible_cpus(), threads_per_core); nr_cores = DIV_ROUND_UP(num_possible_cpus(), threads_per_core);
pmu_ptr->mem_info = kcalloc(nr_cores, sizeof(struct imc_mem_info), pmu_ptr->mem_info = kcalloc(nr_cores, sizeof(struct imc_mem_info),
GFP_KERNEL); GFP_KERNEL);
if (!pmu_ptr->mem_info) if (!pmu_ptr->mem_info)
return -ENOMEM; goto err;
core_imc_refc = kcalloc(nr_cores, sizeof(struct imc_pmu_ref), core_imc_refc = kcalloc(nr_cores, sizeof(struct imc_pmu_ref),
GFP_KERNEL); GFP_KERNEL);
if (!core_imc_refc) { if (!core_imc_refc) {
kfree(pmu_ptr->mem_info); kfree(pmu_ptr->mem_info);
return -ENOMEM; goto err;
} }
core_imc_pmu = pmu_ptr; core_imc_pmu = pmu_ptr;
...@@ -1285,14 +1285,14 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent, ...@@ -1285,14 +1285,14 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
/* Update the pmu name */ /* Update the pmu name */
pmu_ptr->pmu.name = kasprintf(GFP_KERNEL, "%s%s", s, "_imc"); pmu_ptr->pmu.name = kasprintf(GFP_KERNEL, "%s%s", s, "_imc");
if (!pmu_ptr->pmu.name) if (!pmu_ptr->pmu.name)
return -ENOMEM; goto err;
thread_imc_mem_size = pmu_ptr->counter_mem_size; thread_imc_mem_size = pmu_ptr->counter_mem_size;
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
res = thread_imc_mem_alloc(cpu, pmu_ptr->counter_mem_size); res = thread_imc_mem_alloc(cpu, pmu_ptr->counter_mem_size);
if (res) { if (res) {
cleanup_all_thread_imc_memory(); cleanup_all_thread_imc_memory();
return res; goto err;
} }
} }
...@@ -1302,6 +1302,8 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent, ...@@ -1302,6 +1302,8 @@ static int imc_mem_init(struct imc_pmu *pmu_ptr, struct device_node *parent,
} }
return 0; return 0;
err:
return res;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册