All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Liang He <windhl@126.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] input/serio: Fix refcount leak bug in i8042-sparcio
Date: Sun, 10 Jul 2022 20:19:20 -0700	[thread overview]
Message-ID: <YsuWuJTQsMlQabqt@google.com> (raw)
In-Reply-To: <5b7bcbf5.3f6.181e5c0dcff.Coremail.windhl@126.com>

On Sun, Jul 10, 2022 at 09:37:10AM +0800, Liang He wrote:
> At 2022-07-09 12:49:23, "Dmitry Torokhov" <dmitry.torokhov@gmail.com> wrote:
> >Hi Liang,
> >
> >On Sun, Jun 19, 2022 at 03:30:36PM +0800, Liang He wrote:
> >> In i8042_platform_init() and i8042_platform_exit(), we need call
> >> of_node_put() to keep refcount balance.
> >> 
> >> Signed-off-by: Liang He <windhl@126.com>
> >> ---
> >>  drivers/input/serio/i8042-sparcio.h | 4 ++++
> >>  1 file changed, 4 insertions(+)
> >> 
> >> diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
> >> index fce76812843b..a2a9db9220d7 100644
> >> --- a/drivers/input/serio/i8042-sparcio.h
> >> +++ b/drivers/input/serio/i8042-sparcio.h
> >> @@ -108,6 +108,8 @@ static int __init i8042_platform_init(void)
> >>  	struct device_node *root = of_find_node_by_path("/");
> >>  	const char *name = of_get_property(root, "name", NULL);
> >>  
> >> +	of_node_put(root);
> >> +
> >>  	if (name && !strcmp(name, "SUNW,JavaStation-1")) {
> >>  		/* Hardcoded values for MrCoffee.  */
> >>  		i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
> >> @@ -139,6 +141,8 @@ static inline void i8042_platform_exit(void)
> >>  	struct device_node *root = of_find_node_by_path("/");
> >>  	const char *name = of_get_property(root, "name", NULL);
> >>  
> >> +	of_node_put(root);
> >> +
> >>  	if (!name || strcmp(name, "SUNW,JavaStation-1"))
> >>  		platform_driver_unregister(&sparc_i8042_driver);
> >>  }
> >
> >There already was an attempt to fix this issue in a slightly better way,
> >unfortunately the original author did not finish the work:
> >
> >https://lore.kernel.org/all/20181212163548.23723-1-tiny.windzz@gmail.com/
> >
> >Thanks.
> >
> >-- 
> >Dmitry
> 
> Hi, Dmirtry,
> 
> Thanks for reviewing my patch code.
> 
> The Li's patch adds a helper and is better than mine.

Right, however there is a compile error in Li's version. It would be
great if someone could finish their work.

Thanks.

-- 
Dmitry

  reply	other threads:[~2022-07-11  3:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-19  7:30 [PATCH] input/serio: Fix refcount leak bug in i8042-sparcio Liang He
2022-07-09  4:49 ` Dmitry Torokhov
2022-07-10  1:37   ` Liang He
2022-07-11  3:19     ` Dmitry Torokhov [this message]
2022-07-11  4:57       ` Re:Re: " Liang He

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=YsuWuJTQsMlQabqt@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=windhl@126.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.