diff mbox series

[v2] xen/events: fix error code in xen_bind_pirq_msi_to_irq()

Message ID 3b9ab040-a92e-4e35-b687-3a95890a9ace@moroto.mountain (mailing list archive)
State Accepted
Commit 7f3da4b698bcc21a6df0e7f114af71d53a3e26ac
Headers show
Series [v2] xen/events: fix error code in xen_bind_pirq_msi_to_irq() | expand

Commit Message

Dan Carpenter Nov. 28, 2023, 6:52 a.m. UTC
Return -ENOMEM if xen_irq_init() fails.  currently the code returns an
uninitialized variable or zero.

Fixes: 5dd9ad32d775 ("xen/events: drop xen_allocate_irqs_dynamic()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: Part of v1 was bogus.  Delete that bit.

 drivers/xen/events/events_base.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jürgen Groß Nov. 28, 2023, 7:03 a.m. UTC | #1
On 28.11.23 07:52, Dan Carpenter wrote:
> Return -ENOMEM if xen_irq_init() fails.  currently the code returns an
> uninitialized variable or zero.
> 
> Fixes: 5dd9ad32d775 ("xen/events: drop xen_allocate_irqs_dynamic()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Juergen Gross <jgross@ssue.com>


Juergen
diff mbox series

Patch

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index f5edb9e27e3c..b8cfea7812d6 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -1110,8 +1110,10 @@  int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
 
 	for (i = 0; i < nvec; i++) {
 		info = xen_irq_init(irq + i);
-		if (!info)
+		if (!info) {
+			ret = -ENOMEM;
 			goto error_irq;
+		}
 
 		irq_set_chip_and_handler_name(irq + i, &xen_pirq_chip, handle_edge_irq, name);