[Intel-xe] [PATCH] drm/xe: Call exit functions when xe_register_pci_driver() fails
Gustavo Sousa
gustavo.sousa at intel.com
Tue May 9 22:20:53 UTC 2023
Make sure all necessary exit functions are also called when
xe_register_pci_driver() fails.
Signed-off-by: Gustavo Sousa <gustavo.sousa at intel.com>
---
drivers/gpu/drm/xe/xe_module.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_module.c b/drivers/gpu/drm/xe/xe_module.c
index 6860586ce7f8..9698875852d3 100644
--- a/drivers/gpu/drm/xe/xe_module.c
+++ b/drivers/gpu/drm/xe/xe_module.c
@@ -53,14 +53,18 @@ static int __init xe_init(void)
for (i = 0; i < ARRAY_SIZE(init_funcs); i++) {
err = init_funcs[i].init();
- if (err) {
- while (i--)
- init_funcs[i].exit();
- return err;
- }
+ if (err)
+ break;
}
- return xe_register_pci_driver();
+ if (!err)
+ err = xe_register_pci_driver();
+
+ if (err)
+ while (i--)
+ init_funcs[i].exit();
+
+ return err;
}
static void __exit xe_exit(void)
--
2.40.0
More information about the Intel-xe
mailing list