If kset_create_and_add fails then most likely due to out-of-memory.
There's not necessarily a bug somewhere.
Therefore I think we shouldn't use BUG_ON and simply return -ENOMEM.
That's also what other callers of kset_create_and_add do.

Signed-off-by: Heiner Kallweit <[email protected]>
---
 drivers/iommu/iommu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index debce45..b36ec9c 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1483,9 +1483,7 @@ static int __init iommu_init(void)
 {
        iommu_group_kset = kset_create_and_add("iommu_groups",
                                               NULL, kernel_kobj);
-       BUG_ON(!iommu_group_kset);
-
-       return 0;
+       return iommu_group_kset ? 0 : -ENOMEM;
 }
 core_initcall(iommu_init);
 
-- 
2.9.0

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to