lkml.org 
[lkml]   [2014]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 09/21] apbps2: use devm_irq_of_parse_and_map()
Date
From: Nikita Yushchenko <nyushchenko@dev.rtsoft.ru>

This avoids leak of IRQ mapping on error paths, and makes it possible
to use devm_request_irq() without facing unmap-while-handler-installed
issues.

Signed-off-by: Nikita Yushchenko <nyushchenko@dev.rtsoft.ru>
---
drivers/input/serio/apbps2.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/serio/apbps2.c b/drivers/input/serio/apbps2.c
index 17e01a8..e8d0b8e 100644
--- a/drivers/input/serio/apbps2.c
+++ b/drivers/input/serio/apbps2.c
@@ -155,7 +155,11 @@ static int apbps2_of_probe(struct platform_device *ofdev)
iowrite32be(0, &priv->regs->ctrl);

/* IRQ */
- irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
+ irq = devm_irq_of_parse_and_map(&ofdev->dev, ofdev->dev.of_node, 0);
+ if (irq <= 0) {
+ dev_err(&ofdev->dev, "unable to locate IRQ\n");
+ return irq ? irq : -EINVAL;
+ }
err = devm_request_irq(&ofdev->dev, irq, apbps2_isr,
IRQF_SHARED, "apbps2", priv);
if (err) {
--
1.7.10.4


\
 
 \ /
  Last update: 2014-06-04 14:22    [W:0.173 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site