Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707484

[PATCH] misc: atmel_tclib: fix error return code in tc_probe()

From "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Newsgroups linux.kernel
Subject [PATCH] misc: atmel_tclib: fix error return code in tc_probe()
Date 2017-08-09 18:50 +0200
Message-ID <ucClc-1qq-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


platform_get_irq() returns an error code, but the atmel_tclib driver
ignores it and always returns -EINVAL. This is not correct and,
prevents -EPROBE_DEFER from being propagated properly.

Print error message and propagate the return value of platform_get_irq
on failure.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/misc/atmel_tclib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/atmel_tclib.c b/drivers/misc/atmel_tclib.c
index ac24a4b..c5d3449 100644
--- a/drivers/misc/atmel_tclib.c
+++ b/drivers/misc/atmel_tclib.c
@@ -112,8 +112,10 @@ static int __init tc_probe(struct platform_device *pdev)
 	unsigned int	i;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return -EINVAL;
+	if (irq < 0) {
+		dev_err(&pdev->dev, "Failed to get IRQ: %d\n", irq);
+		return irq;
+	}
 
 	tc = devm_kzalloc(&pdev->dev, sizeof(struct atmel_tc), GFP_KERNEL);
 	if (!tc)
-- 
2.5.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] misc: atmel_tclib: fix error return code in tc_probe() "Gustavo A. R. Silva" <gustavo@embeddedor.com> - 2017-08-09 18:50 +0200
  Re: [PATCH] misc: atmel_tclib: fix error return code in tc_probe() Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-08-10 00:10 +0200

csiph-web