public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Kulikov Vasiliy <segooon@gmail.com>
To: kernel-janitors@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	Alan Cox <alan@linux.intel.com>,
	Dan Carpenter <error27@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: mrst-touchscreen: fix leaks
Date: Mon, 12 Jul 2010 14:48:04 +0000	[thread overview]
Message-ID: <1278946084-30228-1-git-send-email-segooon@gmail.com> (raw)

mrstouch_probe() must unregister input device, free requested IRQ and
input device in error path.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/staging/mrst-touchscreen/intel-mid-touch.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mrst-touchscreen/intel-mid-touch.c b/drivers/staging/mrst-touchscreen/intel-mid-touch.c
index abba22f..8a72bbf 100644
--- a/drivers/staging/mrst-touchscreen/intel-mid-touch.c
+++ b/drivers/staging/mrst-touchscreen/intel-mid-touch.c
@@ -779,7 +779,7 @@ static int __devinit mrstouch_probe(struct spi_device *mrstouch_spi)
 				0, "mrstouch", tsdev);
 	if (err) {
 		dev_err(&tsdev->spi->dev, "unable to allocate irq\n");
-		goto mrstouch_err_free_mem;
+		goto mrstouch_err_unreg_input;
 	}
 
 	tsdev->pendet_thrd = kthread_run(mrstouch_pendet,
@@ -787,11 +787,16 @@ static int __devinit mrstouch_probe(struct spi_device *mrstouch_spi)
 	if (IS_ERR(tsdev->pendet_thrd)) {
 		dev_err(&tsdev->spi->dev, "kthread_run failed\n");
 		err = PTR_ERR(tsdev->pendet_thrd);
-		goto mrstouch_err_free_mem;
+		goto mrstouch_err_free_irq;
 	}
 	mrstouch_debug("%s", "Driver initialized");
 	return 0;
 
+mrstouch_err_free_irq:
+	free_irq(myirq, tsdev);
+mrstouch_err_unreg_input:
+	input_unregister_device(mrstouchdevp->input);
+	input_free_device(mrstouchdevp->input);
 mrstouch_err_free_mem:
 	kfree(tsdev);
 	return err;
-- 
1.7.0.4


             reply	other threads:[~2010-07-12 14:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12 14:48 Kulikov Vasiliy [this message]
2010-07-12 14:57 ` [PATCH] staging: mrst-touchscreen: fix leaks Alan Cox

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=1278946084-30228-1-git-send-email-segooon@gmail.com \
    --to=segooon@gmail.com \
    --cc=alan@linux.intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=error27@gmail.com \
    --cc=gregkh@suse.de \
    --cc=kernel-janitors@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox