The 'out_of_memory' label is only accessible by means of a goto jump
that only happens once. Take the required actions right after the error
happens, and drop the need for a jump out of the loop.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/virt/fsl_hypervisor.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c
index 7c7ec13761ba..bc5d7aa246df 100644
--- a/drivers/virt/fsl_hypervisor.c
+++ b/drivers/virt/fsl_hypervisor.c
@@ -848,7 +848,13 @@ static int __init fsl_hypervisor_init(void)
dbisr = kzalloc(sizeof(*dbisr), GFP_KERNEL);
if (!dbisr) {
of_node_put(np);
- goto out_of_memory;
+ list_for_each_entry_safe(dbisr, n, &isr_list, list) {
+ free_irq(dbisr->irq, dbisr);
+ list_del(&dbisr->list);
+ kfree(dbisr);
+ }
+ misc_deregister(&fsl_hv_misc_dev);
+ return -ENOMEM;
}
dbisr->irq = irq;
@@ -895,17 +901,6 @@ static int __init fsl_hypervisor_init(void)
}
return 0;
-
-out_of_memory:
- list_for_each_entry_safe(dbisr, n, &isr_list, list) {
- free_irq(dbisr->irq, dbisr);
- list_del(&dbisr->list);
- kfree(dbisr);
- }
-
- misc_deregister(&fsl_hv_misc_dev);
-
- return -ENOMEM;
}
/*
--
2.43.0