public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Donggeun Kim <dg77.kim@samsung.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <greg@kroah.com>
Subject: [PATCH RESEND] misc: Fix irq leak in max8997_muic_probe error path
Date: Mon, 26 Mar 2012 09:57:08 +0800	[thread overview]
Message-ID: <1332727028.7078.4.camel@phoenix> (raw)

Current code does not properly free allocated irqs if request_threaded_irq
returns error, fix it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
---
This patch was sent on LKML:https://lkml.org/lkml/2011/12/17/114
This resend re-generate the patch because it does not apply due to
the change in commit 71e5878 "misc: Remove max8997-muic sysfs attributes".

 drivers/misc/max8997-muic.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/max8997-muic.c b/drivers/misc/max8997-muic.c
index 19591ea..2e7df9c 100644
--- a/drivers/misc/max8997-muic.c
+++ b/drivers/misc/max8997-muic.c
@@ -440,10 +440,6 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev)
 				"failed: irq request (IRQ: %d,"
 				" error :%d)\n",
 				muic_irq->irq, ret);
-
-			for (i = i - 1; i >= 0; i--)
-				free_irq(muic_irq->irq, info);
-
 			goto err_irq;
 		}
 	}
@@ -457,6 +453,8 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev)
 	return ret;
 
 err_irq:
+	while (--i >= 0)
+		free_irq(pdata->irq_base + muic_irqs[i].irq, info);
 err_pdata:
 	kfree(info);
 err_kfree:
-- 
1.7.5.4




             reply	other threads:[~2012-03-26  1:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26  1:57 Axel Lin [this message]
2012-03-26  8:17 ` [PATCH RESEND] misc: Fix irq leak in max8997_muic_probe error path Arnd Bergmann

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=1332727028.7078.4.camel@phoenix \
    --to=axel.lin@gmail.com \
    --cc=arnd@arndb.de \
    --cc=dg77.kim@samsung.com \
    --cc=greg@kroah.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.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