Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-xe] [PATCH] drm/xe: Call exit functions when xe_register_pci_driver() fails
@ 2023-05-09 22:20 Gustavo Sousa
  2023-05-09 22:23 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Gustavo Sousa @ 2023-05-09 22:20 UTC (permalink / raw)
  To: intel-xe

Make sure all necessary exit functions are also called when
xe_register_pci_driver() fails.

Signed-off-by: Gustavo Sousa <gustavo.sousa@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


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

end of thread, other threads:[~2023-05-11 18:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09 22:20 [Intel-xe] [PATCH] drm/xe: Call exit functions when xe_register_pci_driver() fails Gustavo Sousa
2023-05-09 22:23 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-05-09 22:24 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-05-09 22:28 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-05-09 22:53 ` [Intel-xe] ○ CI.BAT: info " Patchwork
2023-05-10 13:22 ` [Intel-xe] [PATCH] " Jani Nikula
2023-05-10 19:58   ` Gustavo Sousa
2023-05-10 20:21     ` Jani Nikula
2023-05-11 18:05       ` Gustavo Sousa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox