[PATCH] xen/mcelog: Use common error handling code in bind_virq_for_mce()

Markus Elfring posted 1 patch 2 days, 14 hours ago
Failed in applying to current master (apply log)
drivers/xen/mcelog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] xen/mcelog: Use common error handling code in bind_virq_for_mce()
Posted by Markus Elfring 2 days, 14 hours ago
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jun 2026 17:05:22 +0200
Subject: [PATCH] xen/mcelog: Use common error handling code in bind_virq_for_mce()

Use an additional label so that a bit of exception handling can be better
reused at the end of an if branch.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/xen/mcelog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/mcelog.c b/drivers/xen/mcelog.c
index 53a8720f5cae..df15d5cf6d4c 100644
--- a/drivers/xen/mcelog.c
+++ b/drivers/xen/mcelog.c
@@ -380,14 +380,14 @@ static int bind_virq_for_mce(void)
 	ret = HYPERVISOR_mca(&mc_op);
 	if (ret) {
 		pr_err("Failed to get CPU info\n");
-		kfree(g_physinfo);
-		return ret;
+		goto free_info;
 	}
 
 	ret  = bind_virq_to_irqhandler(VIRQ_MCA, 0,
 				       xen_mce_interrupt, 0, "mce", NULL);
 	if (ret < 0) {
 		pr_err("Failed to bind virq\n");
+free_info:
 		kfree(g_physinfo);
 		return ret;
 	}
-- 
2.54.0