From: Greg KH <gregkh@linuxfoundation.org>
To: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Cc: rafael@kernel.org, lenb@kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] PNP: add a error handling in pnpacpi_init()
Date: Thu, 18 Dec 2025 12:33:05 +0100 [thread overview]
Message-ID: <2025121841-unwoven-twelve-e65b@gregkh> (raw)
In-Reply-To: <20251218082903.551296-1-lihaoxiang@isrc.iscas.ac.cn>
On Thu, Dec 18, 2025 at 04:29:03PM +0800, Haoxiang Li wrote:
> Add a error handling for pnp_register_protocol(), and if
> it fails, call put_device() to drop the device reference.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
> ---
> drivers/pnp/pnpacpi/core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
> index a0927081a003..0b63e1748b7c 100644
> --- a/drivers/pnp/pnpacpi/core.c
> +++ b/drivers/pnp/pnpacpi/core.c
> @@ -304,7 +304,10 @@ static int __init pnpacpi_init(void)
> return 0;
> }
> printk(KERN_INFO "pnp: PnP ACPI init\n");
> - pnp_register_protocol(&pnpacpi_protocol);
> + if (pnp_register_protocol(&pnpacpi_protocol)) {
> + put_device(&pnpacpi_protocol.dev);
Again, this looks really wrong.
What tool are you all using to "find" these issues? Why aren't you
properly documenting it?
thanks,
greg k-h
next prev parent reply other threads:[~2025-12-18 11:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 8:29 [PATCH] PNP: add a error handling in pnpacpi_init() Haoxiang Li
2025-12-18 11:33 ` Greg KH [this message]
2025-12-18 12:24 ` Haoxiang Li
2025-12-18 12:40 ` Greg KH
2025-12-18 13:07 ` Haoxiang Li
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=2025121841-unwoven-twelve-e65b@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=lenb@kernel.org \
--cc=lihaoxiang@isrc.iscas.ac.cn \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=stable@vger.kernel.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