From: Yangtao Li <tiny.windzz@gmail.com>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Yangtao Li <tiny.windzz@gmail.com>
Subject: [PATCH] Input: i8042 add of_node_put()
Date: Wed, 21 Nov 2018 09:35:13 -0500 [thread overview]
Message-ID: <20181121143513.22961-1-tiny.windzz@gmail.com> (raw)
use of_node_put() to release the refcount.
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
drivers/input/serio/i8042-sparcio.h | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index 796289846204..5495bc035518 100644
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -108,18 +108,21 @@ static struct platform_driver sparc_i8042_driver = {
static int __init i8042_platform_init(void)
{
+ int rc;
struct device_node *root = of_find_node_by_path("/");
if (!strcmp(root->name, "SUNW,JavaStation-1")) {
/* Hardcoded values for MrCoffee. */
i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
kbd_iobase = ioremap(0x71300060, 8);
- if (!kbd_iobase)
- return -ENODEV;
+ if (!kbd_iobase){
+ rc = -ENODEV;
+ goto out;
+ }
} else {
- int err = platform_driver_register(&sparc_i8042_driver);
- if (err)
- return err;
+ rc = platform_driver_register(&sparc_i8042_driver);
+ if (rc)
+ goto out;
if (i8042_kbd_irq == -1 ||
i8042_aux_irq == -1) {
@@ -127,13 +130,18 @@ static int __init i8042_platform_init(void)
of_iounmap(kbd_res, kbd_iobase, 8);
kbd_iobase = (void __iomem *) NULL;
}
- return -ENODEV;
+ rc = -ENODEV;
+ goto out;
}
}
i8042_reset = I8042_RESET_ALWAYS;
- return 0;
+ rc = 0;
+out:
+ of_node_put(root);
+
+ return rc;
}
static inline void i8042_platform_exit(void)
@@ -142,6 +150,8 @@ static inline void i8042_platform_exit(void)
if (strcmp(root->name, "SUNW,JavaStation-1"))
platform_driver_unregister(&sparc_i8042_driver);
+
+ of_node_put(root);
}
#else /* !CONFIG_PCI */
--
2.17.0
next reply other threads:[~2018-11-21 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 14:35 Yangtao Li [this message]
2018-11-29 18:36 ` [PATCH] Input: i8042 add of_node_put() Dmitry Torokhov
2018-12-09 5:22 ` 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=20181121143513.22961-1-tiny.windzz@gmail.com \
--to=tiny.windzz@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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 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.