devfreq: tegra: fix error code in tegra_devfreq_probe()
Subsystems (2)
PATCH 1/1 devfreq: tegra: fix error code in tegra_devfreq_probe()
Print and propagate the return value of platform_get_irq on failure.
--- drivers/devfreq/tegra-devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/devfreq/tegra-devfreq.c +3 -3
@@ -688,9 +688,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); -return -ENODEV ; +if (irq <0 ) { +dev_err (&pdev->dev,"Failed to get IRQ: %d\n" , irq); +return irq; }platform_set_drvdata (pdev, tegra);
Signature · 1 line
2.5.0
Hi,
Quoted 15 lines · Gustavo A. R. Silva
Print and propagate the return value of
platform_get_irqon failure.Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/devfreq/tegra-devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/devfreq/tegra-devfreq.c +0
-0@@ -688,9 +688,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) }
drivers/devfreq/tegra-devfreq.c static int tegra_devfreq_probe(struct platform_device *pdev) · line 696
Quoted 10 lines
drivers/devfreq/tegra-devfreq.c +3
-3irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); -return -ENODEV ; +if (irq <0 ) { +dev_err (&pdev->dev,"Failed to get IRQ: %d\n" , irq); +return irq; }platform_set_drvdata (pdev, tegra);
Signature · 3 lines
Best Regards, Chanwoo Choi Samsung Electronics
Quoted 26 lines · Chanwoo Choi
Hi,
Quoted 23 lines · Gustavo A. R. Silva
Print and propagate the return value of
platform_get_irqon failure.Signed-off-by Gustavo A. R. Silva <garsilva-L1vi/[email protected]>--- drivers/devfreq/tegra-devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/devfreq/tegra-devfreq.c +3
-3@@ -688,9 +688,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); -return -ENODEV ; +if (irq <0 ) { +dev_err (&pdev->dev,"Failed to get IRQ: %d\n" , irq); +return irq; }
Quoted 4 lines
drivers/devfreq/tegra-devfreq.c static int tegra_devfreq_probe(struct platform_device *pdev) · line 696
Quoted 2 lines
drivers/devfreq/tegra-devfreq.c +0
-0platform_set_drvdata (pdev, tegra);Reviewed-by Chanwoo Choi <[email protected]>
Quoted 5 lines
--
Best Regards,
Chanwoo Choi
Samsung Electronics
Signature · 2 lines
MyungJoo Ham, Ph.D. S/W Center, Samsung Electronics
Jon Hunter
maintainerQuoted 12 lines · Gustavo A. R. Silva
Print and propagate the return value of
platform_get_irqon failure.Signed-off-by Gustavo A. R. Silva <garsilva-L1vi/[email protected]>--- drivers/devfreq/tegra-devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/devfreq/tegra-devfreq.c +0
-0
drivers/devfreq/tegra-devfreq.c static int tegra_devfreq_probe(struct platform_device *pdev) · line 691
Quoted 7 lines
drivers/devfreq/tegra-devfreq.c +1
-3@@ -688,9 +688,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); -return -ENODEV ; +if (irq <0 ) {
The changelog does not describe the above change and if/why this is ok. However, the original test looks fine to me and so I don't see a need to change this.
drivers/devfreq/tegra-devfreq.c static int tegra_devfreq_probe(struct platform_device *pdev) · line 693
Quoted 2 lines
drivers/devfreq/tegra-devfreq.c +2
-0+dev_err (&pdev->dev,"Failed to get IRQ: %d\n" , irq); +return irq;
Why not have ...
return irq ? irq : -ENODEV;
Cheers
Jon
Signature · 1 line
nvpublic
Hi Jon,
Quoting Jon Hunter <[email protected]>:
Quoted 16 lines · Gustavo A. R. Silva
Quoted 15 lines
Print and propagate the return value of
platform_get_irqon failure.Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/devfreq/tegra-devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/devfreq/tegra-devfreq.c +0
-0@@ -688,9 +688,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) }
Quoted 10 lines
drivers/devfreq/tegra-devfreq.c static int tegra_devfreq_probe(struct platform_device *pdev) · line 691
Quoted 5 lines
drivers/devfreq/tegra-devfreq.c +1
-3irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); -return -ENODEV ; +if (irq <0 ) {The changelog does not describe the above change and if/why this is ok. However, the original test looks fine to me and so I don't see a need to change this.
You are right about the changelog. I think this one is much better:
platform_get_irq() returns an error code, but the tegra-devfreq driver ignores it and always returns -ENODEV. 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 error message and propagate the return value of platform_get_irq on failure.
What do you think?
Thank you!
--
Gustavo A. R. Silva
Jon Hunter
maintainerQuoted 32 lines · Gustavo A. R. Silva
Hi Jon,
Quoting Jon Hunter <[email protected]>:
Quoted 17 lines · Gustavo A. R. Silva
Quoted 16 lines
Print and propagate the return value of
platform_get_irqon failure.Signed-off-by Gustavo A. R. Silva <garsilva-L1vi/[email protected]>--- drivers/devfreq/tegra-devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/devfreq/tegra-devfreq.c +0
-0@@ -688,9 +688,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) }Quoted 10 lines
drivers/devfreq/tegra-devfreq.c static int tegra_devfreq_probe(struct platform_device *pdev) · line 691
Quoted 5 lines
drivers/devfreq/tegra-devfreq.c +1
-3irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); -return -ENODEV ; +if (irq <0 ) {The changelog does not describe the above change and if/why this is ok. However, the original test looks fine to me and so I don't see a need to change this.
Quoted 8 lines
You are right about the changelog. I think this one is much better:
platform_get_irq()returns an error code, but the tegra-devfreq driver ignores it and always returns-ENODEV. 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
Yes the above should be added to the changelog.
Looks like someone should update the following for consistency too ...
141 int platform_irq_count(struct platform_device *dev) 142 {
143 int ret, nr = 0;
144
145 while ((ret = platform_get_irq(dev, nr)) >= 0)
146 nr++;
Quoted 5 lines
Print error message and propagate the return value of
platform_get_irqon failure.What do you think?
Fine with me.
Thanks!
Jon
Signature · 1 line
nvpublic
PATCH v2 1/1 devfreq: tegra: fix error return code in tegra_devfreq_probe()
platform_get_irq() returns an error code, but the tegra-devfreq driver ignores it and always returns -ENODEV. 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/tegra-devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/devfreq/tegra-devfreq.c +3 -3
@@ -688,9 +688,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); -return -ENODEV ; +if (irq <0 ) { +dev_err (&pdev->dev,"Failed to get IRQ: %d\n" , irq); +return irq; }platform_set_drvdata (pdev, tegra);
Signature · 1 line
2.5.0
Re: [PATCH v2] devfreq: tegra: fix error return code in tegra_devfreq_probe()
Quoted 26 lines · Gustavo A. R. Silva
platform_get_irq()returns an error code, but the tegra-devfreq driver ignores it and always returns-ENODEV. 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=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92afPrint and propagate the return value of
platform_get_irqon failure.Reviewed-by Chanwoo Choi <[email protected]>Acked-by MyungJoo Ham <[email protected]>Signed-off-by Gustavo A. R. Silva <garsilva-L1vi/[email protected]>---
Changes in v2:
Rewrite commit message.drivers/devfreq/tegra-devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/devfreq/tegra-devfreq.c +0
-0@@ -688,9 +688,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) }
drivers/devfreq/tegra-devfreq.c static int tegra_devfreq_probe(struct platform_device *pdev) · line 696
Quoted 10 lines
drivers/devfreq/tegra-devfreq.c +3
-3irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); -return -ENODEV ; +if (irq <0 ) { +dev_err (&pdev->dev,"Failed to get IRQ: %d\n" , irq); +return irq; }platform_set_drvdata (pdev, tegra);
Thanks.
Cheers
Jon
Signature · 1 line
nvpublic
Re: [PATCH v2] devfreq: tegra: fix error return code in tegra_devfreq_probe()
Quoted 37 lines · Jon Hunter
Quoted 35 lines · Gustavo A. R. Silva
platform_get_irq()returns an error code, but the tegra-devfreq driver ignores it and always returns-ENODEV. 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=e330b9a6bb35dc7097a4f02cb1ae7b6f96df92afPrint and propagate the return value of
platform_get_irqon failure.Reviewed-by Chanwoo Choi <[email protected]>Acked-by MyungJoo Ham <[email protected]>Signed-off-by Gustavo A. R. Silva <[email protected]>---
Changes in v2:
Rewrite commit message.drivers/devfreq/tegra-devfreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/devfreq/tegra-devfreq.c +3
-3@@ -688,9 +688,9 @@ static int tegra_devfreq_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); -return -ENODEV ; +if (irq <0 ) { +dev_err (&pdev->dev,"Failed to get IRQ: %d\n" , irq); +return irq; }
Quoted 6 lines
drivers/devfreq/tegra-devfreq.c static int tegra_devfreq_probe(struct platform_device *pdev) · line 696
Quoted 1 line
drivers/devfreq/tegra-devfreq.c +0
-0platform_set_drvdata (pdev, tegra);Thanks.
Acked-by Jon Hunter <[email protected]>
Thank you, Jon.
Signature · 1 line
Gustavo A. R. Silva