Skip to contentSkip to conversation

pata_imx: print error message on platform_get_irq failure

PATCH New Gustavo A. R. Silva 3 participants 6 messages Jun 30, 2017 – Jul 1, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pata_imx: print error message on platform_get_irq failure

Print error message on platform_get_irq failure before return.

---
 drivers/ata/pata_imx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/ata/pata_imx.c +3 -1
index d4caa23..65bbf36 100644
@@ -132,8 +132,10 @@ static int pata_imx_probe(struct platform_device *pdev)
 	int ret;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		dev_err(&pdev->dev, "failed to get IRQ\n");
 		return irq;
+	}
 
 	priv = devm_kzalloc(&pdev->dev,
 				sizeof(struct pata_imx_priv), GFP_KERNEL);
Signature · 1 line
2.5.0
#1 lore raw

PATCH v2 1/1 pata_imx: print error message on platform_get_irq failure

Print error message on platform_get_irq failure before return.

---
Changes in v2:
Print the return value of platform_get_irq on failure.

 drivers/ata/pata_imx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/pata_imx.c +3 -2
index d4caa23..66fb1ab 100644
@@ -132,9 +132,10 @@ static int pata_imx_probe(struct platform_device *pdev)
 	int ret;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
 		return irq;
-
+	}
 	priv = devm_kzalloc(&pdev->dev,
 				sizeof(struct pata_imx_priv), GFP_KERNEL);
 	if (!priv)
Signature · 1 line
2.5.0
#2 lore raw
Quoted 15 lines · Gustavo A. R. Silva

Print error message on platform_get_irq failure before return.

---
Changes in v2:
Print the return value of platform_get_irq on failure.

 drivers/ata/pata_imx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/pata_imx.c +0 -0
index d4caa23..66fb1ab 100644

drivers/ata/pata_imx.c static int pata_imx_probe(struct platform_device *pdev) · line 138

Quoted 9 lines
drivers/ata/pata_imx.c +3 -2
@@ -132,9 +132,10 @@ static int pata_imx_probe(struct platform_device *pdev)
 	int ret;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
 		return irq;
-
+	}

Removing empty line here doesn't seem a good idea...

drivers/ata/pata_imx.c static int pata_imx_probe(struct platform_device *pdev) · line 141

Quoted 3 lines
drivers/ata/pata_imx.c +0 -0
 	priv = devm_kzalloc(&pdev->dev,
 				sizeof(struct pata_imx_priv), GFP_KERNEL);
 	if (!priv)

MBR, Sergei

#3 lore raw

Quoting Sergei Shtylyov <[email protected]>:

Quoted 19 lines · Gustavo A. R. Silva
Quoted 18 lines

Print error message on platform_get_irq failure before return.

---
Changes in v2:
Print the return value of platform_get_irq on failure.

drivers/ata/pata_imx.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/pata_imx.c +0 -0
index d4caa23..66fb1ab 100644
@@ -132,9 +132,10 @@ static int pata_imx_probe(struct platform_device *pdev)
 	int ret;
 
Quoted 10 lines

drivers/ata/pata_imx.c static int pata_imx_probe(struct platform_device *pdev) · line 138

Quoted 7 lines
drivers/ata/pata_imx.c +3 -2
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
 		return irq;
-
+	}

Removing empty line here doesn't seem a good idea...

Oh yeah, I agree.
I'll send v3 shortly.

Thanks!
--
Gustavo A. R. Silva

#4 lore raw

PATCH v3 1/1 pata_imx: print error message on platform_get_irq failure

Print error message on platform_get_irq failure before return.

---
Changes in v2:
Print the return value of platform_get_irq on failure.

Changes in v3:
Put back the blank line after the IF closing brace, which was accidentally removed in v2.

 drivers/ata/pata_imx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/ata/pata_imx.c +3 -1
index d4caa23..cdae3c0 100644
@@ -132,8 +132,10 @@ static int pata_imx_probe(struct platform_device *pdev)
 	int ret;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
 		return irq;
+	}
 
 	priv = devm_kzalloc(&pdev->dev,
 				sizeof(struct pata_imx_priv), GFP_KERNEL);
Signature · 1 line
2.5.0
#5 lore raw
In reply to Gustavo A. R. Silva

Hello Gustavo,

Quoted 18 lines · Gustavo A. R. Silva

Print error message on platform_get_irq failure before return.

---
Changes in v2:
Print the return value of platform_get_irq on failure.

 drivers/ata/pata_imx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/pata_imx.c +0 -0
index d4caa23..66fb1ab 100644
@@ -132,9 +132,10 @@ static int pata_imx_probe(struct platform_device *pdev)
 	int ret;
 

drivers/ata/pata_imx.c static int pata_imx_probe(struct platform_device *pdev) · line 141

Quoted 10 lines
drivers/ata/pata_imx.c +3 -2
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
 		return irq;
-
+	}
 	priv = devm_kzalloc(&pdev->dev,
 				sizeof(struct pata_imx_priv), GFP_KERNEL);
 	if (!priv)

this patch is wrong, I've explained why at https://lkml.org/lkml/2017/6/30/144

Please handle -EPROBE_DEFER case, when your change adds the second (redundant) error level message printed to the kernel log.

--
With best wishes,
Vladimir