All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommufd: fix returns ENOENT in iommufd_viommu_get_vdev_id()
@ 2025-08-04 10:08 Richard Gemego
  2025-08-04 11:25 ` Pranjal Shrivastava
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Gemego @ 2025-08-04 10:08 UTC (permalink / raw)
  To: nicolinc, baolu.lu, kevin.tian, jgg; +Cc: iommu, Richard Gemego, Quan Zhou

In iommufd_viommu_get_vdev_id(), if viommu does not have any vdevs, fix
this func to return 0 instead of ENOENT.

Fixes: ea94b211c548 ("iommufd/viommu: Add iommufd_viommu_get_vdev_id helper")
Signed-off-by: Richard Gemego <richardgemego@gmail.com>
Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
---
 drivers/iommu/iommufd/driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/iommufd/driver.c b/drivers/iommu/iommufd/driver.c
index 922cd1fe7ec2..ad635af8555b 100644
--- a/drivers/iommu/iommufd/driver.c
+++ b/drivers/iommu/iommufd/driver.c
@@ -68,6 +68,7 @@ int iommufd_viommu_get_vdev_id(struct iommufd_viommu *viommu,
 			break;
 		}
 	}
+	if (!index) 
+		rc = 0;
 	xa_unlock(&viommu->vdevs);
 	return rc;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-05  3:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-04 10:08 [PATCH] iommufd: fix returns ENOENT in iommufd_viommu_get_vdev_id() Richard Gemego
2025-08-04 11:25 ` Pranjal Shrivastava
2025-08-04 17:44   ` Nicolin Chen
2025-08-05  2:46     ` Richard Gemego
2025-08-05  3:33       ` Nicolin Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.