From: Bjorn Helgaas <helgaas@kernel.org>
To: Yuan Can <yuancan@huawei.com>
Cc: bhelgaas@google.com, gregkh@suse.de, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: cpqphp: Fix error handling in cpqhpc_init()
Date: Tue, 22 Nov 2022 14:05:51 -0600 [thread overview]
Message-ID: <20221122200551.GA212321@bhelgaas> (raw)
In-Reply-To: <20221122101346.80461-1-yuancan@huawei.com>
On Tue, Nov 22, 2022 at 10:13:46AM +0000, Yuan Can wrote:
> The cpqhpc_init() returns the result of pci_register_driver() without
> checking it, if pci_register_driver() failed, the debugfs created in
> cpqhp_initialize_debugfs() is not removed, resulting the debugfs of
> cpqhp can never be created later.
> Fix by calling cpqhp_shutdown_debugfs() when pci_register_driver() failed.
Add a blank line between paragraphs.
> Fixes: 9f3f4681291f ("[PATCH] PCI Hotplug: fix up the sysfs file in the compaq pci hotplug driver")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
> drivers/pci/hotplug/cpqphp_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
> index c94b40e64baf..c47981ef92ea 100644
> --- a/drivers/pci/hotplug/cpqphp_core.c
> +++ b/drivers/pci/hotplug/cpqphp_core.c
> @@ -1389,6 +1389,8 @@ static int __init cpqhpc_init(void)
> info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
> cpqhp_initialize_debugfs();
> result = pci_register_driver(&cpqhpc_driver);
> + if (result)
> + cpqhp_shutdown_debugfs();
Is there some reason cpqhp_initialize_debugfs() needs to be called
before pci_register_driver()?
In other words, could we do this instead?
result = pci_register_driver(&cpqhpc_driver);
if (result)
return result;
cpqhp_initialize_debugfs();
return 0;
I assume this was found by code inspection? I've never heard of
anybody actually using this driver :)
> dbg("pci_register_driver = %d\n", result);
> return result;
> }
> --
> 2.17.1
>
next prev parent reply other threads:[~2022-11-22 20:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 10:13 [PATCH] PCI: cpqphp: Fix error handling in cpqhpc_init() Yuan Can
2022-11-22 20:05 ` Bjorn Helgaas [this message]
2022-11-23 2:18 ` Yuan Can
-- strict thread matches above, loose matches on Subject: below --
2024-10-22 9:29 Yuan Can
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=20221122200551.GA212321@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=gregkh@suse.de \
--cc=linux-pci@vger.kernel.org \
--cc=yuancan@huawei.com \
/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