From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Navid Emamdoost <navid.emamdoost@gmail.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: emamd001@umn.edu, wu000273@umn.edu, kjlu@umn.edu, smccaman@umn.edu
Subject: [PATCH] Input: omap4-keypad: fix ref count leak if pm_runtime_get_sync fails
Date: Sun, 14 Jun 2020 00:52:07 -0500 [thread overview]
Message-ID: <20200614055208.86350-1-navid.emamdoost@gmail.com> (raw)
calling pm_runtime_get_sync increments the counter even in case of
failure, leading to incorrect ref count. In case of failure, decrement
the ref count before returning.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/input/keyboard/omap4-keypad.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 94c94d7f5155..35ac788d9fa0 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -280,7 +280,7 @@ static int omap4_keypad_probe(struct platform_device *pdev)
error = pm_runtime_get_sync(&pdev->dev);
if (error) {
dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n");
- goto err_unmap;
+ goto err_pm_put_sync;
}
rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION);
rev &= 0x03 << 30;
@@ -372,7 +372,6 @@ static int omap4_keypad_probe(struct platform_device *pdev)
input_free_device(input_dev);
err_pm_put_sync:
pm_runtime_put_sync(&pdev->dev);
-err_unmap:
iounmap(keypad_data->base);
err_release_mem:
release_mem_region(res->start, resource_size(res));
--
2.17.1
reply other threads:[~2020-06-14 5:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200614055208.86350-1-navid.emamdoost@gmail.com \
--to=navid.emamdoost@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=emamd001@umn.edu \
--cc=kjlu@umn.edu \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=smccaman@umn.edu \
--cc=wu000273@umn.edu \
/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).