[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240325110333.249-1-gavin.liu@jaguarmicro.com>
Date: Mon, 25 Mar 2024 19:03:33 +0800
From: "gavin.liu" <gavin.liu@...uarmicro.com>
To: jasowang@...hat.com,
mst@...hat.com
Cc: xuanzhuo@...ux.alibaba.com,
virtualization@...ts.linux.dev,
yuxue.liu@...uarmicro.com,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] vp_vdpa: Fix return value check vp_vdpa_request_irq
From: Yuxue Liu <yuxue.liu@...uarmicro.com>
In the vp_vdpa_set_status function, when setting the device status to
VIRTIO_CONFIG_S_DRIVER_OK, the vp_vdpa_request_irq function may fail.
In such cases, the device status should not be set to DRIVER_OK. Add
exception printing to remind the user.
Signed-off-by: Yuxue Liu <yuxue.liu@...uarmicro.com>
---
V1 -> V2: Remove redundant printouts
V1: https://lore.kernel.org/all/20240315102857.1803-1-gavin.liu@jaguarmicro.com/
---
drivers/vdpa/virtio_pci/vp_vdpa.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c
index df5f4a3bccb5..4caca0517cad 100644
--- a/drivers/vdpa/virtio_pci/vp_vdpa.c
+++ b/drivers/vdpa/virtio_pci/vp_vdpa.c
@@ -216,7 +216,10 @@ static void vp_vdpa_set_status(struct vdpa_device *vdpa, u8 status)
if (status & VIRTIO_CONFIG_S_DRIVER_OK &&
!(s & VIRTIO_CONFIG_S_DRIVER_OK)) {
- vp_vdpa_request_irq(vp_vdpa);
+ if (vp_vdpa_request_irq(vp_vdpa)) {
+ WARN_ON(1);
+ return;
+ }
}
vp_modern_set_status(mdev, status);
--
2.43.0
Powered by blists - more mailing lists