My static checker complains that we return an uninitialized scalar if
the list is empty.  If that's the case then we should return zero.

Fixes: 6c65fb318e8b ("iommu: iommu_get_group_resv_regions")
Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index b752c3d91cfc..0e1750481ebc 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -210,9 +210,9 @@ iommu_insert_device_resv_regions(struct list_head 
*dev_resv_regions,
        list_for_each_entry(entry, dev_resv_regions, list) {
                ret = iommu_insert_resv_region(entry, group_resv_regions);
                if (ret)
-                       break;
+                       return ret;
        }
-       return ret;
+       return 0;
 }
 
 int iommu_get_group_resv_regions(struct iommu_group *group,
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to