linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Yangtao Li <tiny.windzz@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] Input: i8042 fix refcount leak
Date: Sat, 8 Dec 2018 21:40:14 -0800	[thread overview]
Message-ID: <20181209054014.GA237502@dtor-ws> (raw)
In-Reply-To: <20181209051900.19035-1-tiny.windzz@gmail.com>

On Sun, Dec 09, 2018 at 12:19:00AM -0500, Yangtao Li wrote:
> use of_node_put() to release the refcount.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  drivers/input/serio/i8042-sparcio.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
> index 796289846204..cc6777b4c4ea 100644
> --- a/drivers/input/serio/i8042-sparcio.h
> +++ b/drivers/input/serio/i8042-sparcio.h
> @@ -111,13 +111,17 @@ static int __init i8042_platform_init(void)
>  	struct device_node *root = of_find_node_by_path("/");
>  
>  	if (!strcmp(root->name, "SUNW,JavaStation-1")) {
> +		of_node_put(root);
>  		/* Hardcoded values for MrCoffee.  */
>  		i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
>  		kbd_iobase = ioremap(0x71300060, 8);
>  		if (!kbd_iobase)
>  			return -ENODEV;
>  	} else {
> -		int err = platform_driver_register(&sparc_i8042_driver);
> +		int err;
> +
> +		of_node_put(root);
> +		err = platform_driver_register(&sparc_i8042_driver);
>  		if (err)
>  			return err;

This is not really what I asked for, as in this version you left out
leaky reference in i8042_platform_exit(). Please make the "detect Mr
Coffee" function and use it in both i8042_platform_init() and
i8042_platform_exit().

Thanks.

-- 
Dmitry

  reply	other threads:[~2018-12-09  5:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-09  5:19 [PATCH v2] Input: i8042 fix refcount leak Yangtao Li
2018-12-09  5:40 ` Dmitry Torokhov [this message]
2018-12-09  6:15   ` Frank Lee

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=20181209054014.GA237502@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiny.windzz@gmail.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;
as well as URLs for NNTP newsgroup(s).