From: Jani Nikula <jani.nikula@linux.intel.com>
To: Gustavo Sousa <gustavo.sousa@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH] drm/xe: Call exit functions when xe_register_pci_driver() fails
Date: Wed, 10 May 2023 16:22:08 +0300 [thread overview]
Message-ID: <87pm78midb.fsf@intel.com> (raw)
In-Reply-To: <20230509222053.1541049-1-gustavo.sousa@intel.com>
On Tue, 09 May 2023, Gustavo Sousa <gustavo.sousa@intel.com> wrote:
> 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();
Why aren't xe_register_pci_driver() and xe_unregister_pci_driver()
init/exit functions in the array? It would avoid the special casing
here, and allow some init functions to be called after register.
BR,
Jani.
> +
> + if (err)
> + while (i--)
> + init_funcs[i].exit();
> +
> + return err;
> }
>
> static void __exit xe_exit(void)
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2023-05-10 13:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Jani Nikula [this message]
2023-05-10 19:58 ` [Intel-xe] [PATCH] " Gustavo Sousa
2023-05-10 20:21 ` Jani Nikula
2023-05-11 18:05 ` Gustavo Sousa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pm78midb.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=gustavo.sousa@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox