mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anthony Olech <anthony.olech.opensource@diasemi.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: <linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Huqiu Liu <liuhq11@mails.tsinghua.edu.cn>,
	David Dajun Chen <david.chen@diasemi.com>
Subject: [PATCH V1] input: fix memory leak in da9052 touchscreen driver
Date: Wed, 8 Jan 2014 16:58:10 +0000	[thread overview]
Message-ID: <201401081709.s08H9nMr038265@swsrvapps-02.lan> (raw)

The touchscreen component driver for the da9052/3 Dialog PMICs
leaks memory by not freeing the input device in the remove call.

This patch matches the existing call to input_alloc_device()
in da9052_ts_probe() to a new call to input_free_device() in
da9052_ts_remove()

Suggested-by: Huqiu Liu <liuhq11@mails.tsinghua.edu.cn>
Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com>
---
This patch is relative to linux-next repository tag next-20140108

Many thanks to Huqiu Liu who found the bug.

 drivers/input/touchscreen/da9052_tsi.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c
index ab64d58..43a69d1 100644
--- a/drivers/input/touchscreen/da9052_tsi.c
+++ b/drivers/input/touchscreen/da9052_tsi.c
@@ -320,6 +320,7 @@ err_free_mem:
 static int  da9052_ts_remove(struct platform_device *pdev)
 {
 	struct da9052_tsi *tsi = platform_get_drvdata(pdev);
+	struct input_dev *input_dev = tsi->dev;
 
 	da9052_reg_write(tsi->da9052, DA9052_LDO9_REG, 0x19);
 
@@ -328,6 +329,7 @@ static int  da9052_ts_remove(struct platform_device *pdev)
 
 	input_unregister_device(tsi->dev);
 	kfree(tsi);
+	input_free_device(input_dev);
 
 	return 0;
 }
-- 
end-of-patch for input: fix memory leak in da9052 touchscreen driver V1


             reply	other threads:[~2014-01-08 17:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 16:58 Anthony Olech [this message]
2014-01-08 17:26 ` Dmitry Torokhov
2014-01-08 18:12   ` Opensource [Anthony Olech]
2014-01-08 19:12     ` Dmitry Torokhov

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=201401081709.s08H9nMr038265@swsrvapps-02.lan \
    --to=anthony.olech.opensource@diasemi.com \
    --cc=david.chen@diasemi.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuhq11@mails.tsinghua.edu.cn \
    /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

all inboxes | Powered by JetHome®