diff mbox series

dmaengine: ti: edma: handle irq_of_parse_and_map() errors

Message ID f15cb6a7-8449-4f79-98b6-34072f04edbc@moroto.mountain (mailing list archive)
State Accepted
Commit 4500d86a2e5115724d58c27cfb3ef590bee0dd58
Headers show
Series dmaengine: ti: edma: handle irq_of_parse_and_map() errors | expand

Commit Message

Dan Carpenter Sept. 15, 2023, 12:59 p.m. UTC
Zero is not a valid IRQ for in-kernel code and the irq_of_parse_and_map()
function returns zero on error.  So this check for valid IRQs should only
accept values > 0.

Fixes: 2b6b3b742019 ("ARM/dmaengine: edma: Merge the two drivers under drivers/dma/")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/dma/ti/edma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Péter Ujfalusi Sept. 19, 2023, 6:09 p.m. UTC | #1
On 9/15/23 15:59, Dan Carpenter wrote:
> Zero is not a valid IRQ for in-kernel code and the irq_of_parse_and_map()
> function returns zero on error.  So this check for valid IRQs should only
> accept values > 0.
> 
> Fixes: 2b6b3b742019 ("ARM/dmaengine: edma: Merge the two drivers under drivers/dma/")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>

> ---
>  drivers/dma/ti/edma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
> index aa8e2e8ac260..33d6d931b33b 100644
> --- a/drivers/dma/ti/edma.c
> +++ b/drivers/dma/ti/edma.c
> @@ -2401,7 +2401,7 @@ static int edma_probe(struct platform_device *pdev)
>  	if (irq < 0 && node)
>  		irq = irq_of_parse_and_map(node, 0);
>  
> -	if (irq >= 0) {
> +	if (irq > 0) {
>  		irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccint",
>  					  dev_name(dev));
>  		ret = devm_request_irq(dev, irq, dma_irq_handler, 0, irq_name,
> @@ -2417,7 +2417,7 @@ static int edma_probe(struct platform_device *pdev)
>  	if (irq < 0 && node)
>  		irq = irq_of_parse_and_map(node, 2);
>  
> -	if (irq >= 0) {
> +	if (irq > 0) {
>  		irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccerrint",
>  					  dev_name(dev));
>  		ret = devm_request_irq(dev, irq, dma_ccerr_handler, 0, irq_name,
Vinod Koul Sept. 28, 2023, 11:56 a.m. UTC | #2
On Fri, 15 Sep 2023 15:59:59 +0300, Dan Carpenter wrote:
> Zero is not a valid IRQ for in-kernel code and the irq_of_parse_and_map()
> function returns zero on error.  So this check for valid IRQs should only
> accept values > 0.
> 
> 

Applied, thanks!

[1/1] dmaengine: ti: edma: handle irq_of_parse_and_map() errors
      commit: 4500d86a2e5115724d58c27cfb3ef590bee0dd58

Best regards,
diff mbox series

Patch

diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
index aa8e2e8ac260..33d6d931b33b 100644
--- a/drivers/dma/ti/edma.c
+++ b/drivers/dma/ti/edma.c
@@ -2401,7 +2401,7 @@  static int edma_probe(struct platform_device *pdev)
 	if (irq < 0 && node)
 		irq = irq_of_parse_and_map(node, 0);
 
-	if (irq >= 0) {
+	if (irq > 0) {
 		irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccint",
 					  dev_name(dev));
 		ret = devm_request_irq(dev, irq, dma_irq_handler, 0, irq_name,
@@ -2417,7 +2417,7 @@  static int edma_probe(struct platform_device *pdev)
 	if (irq < 0 && node)
 		irq = irq_of_parse_and_map(node, 2);
 
-	if (irq >= 0) {
+	if (irq > 0) {
 		irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccerrint",
 					  dev_name(dev));
 		ret = devm_request_irq(dev, irq, dma_ccerr_handler, 0, irq_name,