iommu/virtio: Handle return of iommu_device_register
Subsystems (2)
PATCH 1/1 iommu/virtio: Handle return of iommu_device_register
iommu_device_register returns an error code and, although it currently never fails, we should check its return value anyway.
Signed-off-by Bo Liu <[email protected]>
--- drivers/iommu/virtio-iommu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/iommu/virtio-iommu.c +5 -2
@@ -1144,7 +1144,9 @@ static int viommu_probe(struct virtio_device *vdev)if (ret) goto err_free_vqs; -iommu_device_register (&viommu->iommu, &viommu_ops, parent_dev); + ret =iommu_device_register (&viommu->iommu, &viommu_ops, parent_dev); +if (ret) + goto err_remove_sysfs;#ifdef CONFIG_PCI if (pci_bus_type.iommu_ops != &viommu_ops) {
@@ -1175,8 +1177,9 @@ static int viommu_probe(struct virtio_device *vdev)return 0 ; err_unregister: -iommu_device_sysfs_remove (&viommu->iommu);iommu_device_unregister (&viommu->iommu); +err_remove_sysfs: +iommu_device_sysfs_remove (&viommu->iommu); err_free_vqs: vdev->config->del_vqs (vdev);
Signature · 1 line
2.27.0