Skip to contentSkip to conversation

devfreq: rk3399_dmc: fix error code in rk3399_dmcfreq_probe()

PATCH Superseded Gustavo A. R. Silva 3 participants 5 messages Jun 30, 2017 – Jul 17, 2017 Device frequency (devfreq)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devfreq: rk3399_dmc: fix error code in rk3399_dmcfreq_probe()

Print and propagate the return value of platform_get_irq on failure.

---
 drivers/devfreq/rk3399_dmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/devfreq/rk3399_dmc.c +3 -2
index 40a2499..1b89ebb 100644
@@ -336,8 +336,9 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		dev_err(&pdev->dev, "Cannot get the dmc interrupt resource\n");
-		return -EINVAL;
+		dev_err(&pdev->dev,
+			"Cannot get the dmc interrupt resource: %d\n", irq);
+		return irq;
 	}
 	data = devm_kzalloc(dev, sizeof(struct rk3399_dmcfreq), GFP_KERNEL);
 	if (!data)
Signature · 1 line
2.5.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 14 lines · Gustavo A. R. Silva

Print and propagate the return value of platform_get_irq on failure.

---
 drivers/devfreq/rk3399_dmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/devfreq/rk3399_dmc.c +0 -0
index 40a2499..1b89ebb 100644
@@ -336,8 +336,9 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 

drivers/devfreq/rk3399_dmc.c static int rk3399_dmcfreq_probe(struct platform_device *pdev) · line 344

Quoted 10 lines
drivers/devfreq/rk3399_dmc.c +3 -2
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		dev_err(&pdev->dev, "Cannot get the dmc interrupt resource\n");
-		return -EINVAL;
+		dev_err(&pdev->dev,
+			"Cannot get the dmc interrupt resource: %d\n", irq);
+		return irq;
 	}
 	data = devm_kzalloc(dev, sizeof(struct rk3399_dmcfreq), GFP_KERNEL);
 	if (!data)
Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
maintainer Acked-by
#2 lore raw
Quoted 16 lines · Chanwoo Choi

Hi,

Quoted 13 lines · Gustavo A. R. Silva

Print and propagate the return value of platform_get_irq on failure.

---
 drivers/devfreq/rk3399_dmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/devfreq/rk3399_dmc.c +0 -0
index 40a2499..1b89ebb 100644
@@ -336,8 +336,9 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 
Quoted 13 lines

drivers/devfreq/rk3399_dmc.c static int rk3399_dmcfreq_probe(struct platform_device *pdev) · line 344

Quoted 11 lines
drivers/devfreq/rk3399_dmc.c +3 -2
      irq = platform_get_irq(pdev, 0);
      if (irq < 0) {
-             dev_err(&pdev->dev, "Cannot get the dmc interrupt resource\n");
-             return -EINVAL;
+             dev_err(&pdev->dev,
+                     "Cannot get the dmc interrupt resource: %d\n", irq);
+             return irq;
      }
      data = devm_kzalloc(dev, sizeof(struct rk3399_dmcfreq), GFP_KERNEL);
      if (!data)
Quoted 5 lines

--
Best Regards,
Chanwoo Choi
Samsung Electronics

Signature · 2 lines
MyungJoo Ham, Ph.D.
S/W Center, Samsung Electronics
#3 lore raw

PATCH v2 1/1 devfreq: rk3399_dmc: fix error return code in rk3399_dmcfreq_probe()

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

Notice that platform_get_irq() no longer returns 0 on error:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af

Print and propagate the return value of platform_get_irq on failure.

---
Changes in v2:
Rewrite commit message.

 drivers/devfreq/rk3399_dmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/devfreq/rk3399_dmc.c +3 -2
index 40a2499..1b89ebb 100644
@@ -336,8 +336,9 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		dev_err(&pdev->dev, "Cannot get the dmc interrupt resource\n");
-		return -EINVAL;
+		dev_err(&pdev->dev,
+			"Cannot get the dmc interrupt resource: %d\n", irq);
+		return irq;
 	}
 	data = devm_kzalloc(dev, sizeof(struct rk3399_dmcfreq), GFP_KERNEL);
 	if (!data)
Signature · 1 line
2.5.0
#4 lore raw
In reply to MyungJoo Ham
Quoted 31 lines · MyungJoo Ham
Quoted 16 lines · Chanwoo Choi

Hi,

Quoted 13 lines · Gustavo A. R. Silva

Print and propagate the return value of platform_get_irq on failure.

---
 drivers/devfreq/rk3399_dmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/devfreq/rk3399_dmc.c +0 -0
index 40a2499..1b89ebb 100644
@@ -336,8 +336,9 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 
Quoted 13 lines

drivers/devfreq/rk3399_dmc.c static int rk3399_dmcfreq_probe(struct platform_device *pdev) · line 344

Quoted 11 lines
drivers/devfreq/rk3399_dmc.c +3 -2
      irq = platform_get_irq(pdev, 0);
      if (irq < 0) {
-             dev_err(&pdev->dev, "Cannot get the dmc interrupt resource\n");
-             return -EINVAL;
+             dev_err(&pdev->dev,
+                     "Cannot get the dmc interrupt resource: %d\n", irq);
+             return irq;
      }
      data = devm_kzalloc(dev, sizeof(struct rk3399_dmcfreq), GFP_KERNEL);
      if (!data)
Quoted 2 lines

Thank you, Chanwoo and MyungJoo.

Signature · 1 line
Gustavo A. R. Silva