linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu: fsl_pamu: Replace NO_IRQ by 0
@ 2022-10-06  5:24 Christophe Leroy
  2022-10-06 10:34 ` Robin Murphy
  2022-11-03 13:45 ` Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-10-06  5:24 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Robin Murphy
  Cc: Christophe Leroy, linux-kernel, iommu

NO_IRQ is used to check the return of irq_of_parse_and_map().

On some architecture NO_IRQ is 0, on other architectures it is -1.

irq_of_parse_and_map() returns 0 on error, independent of NO_IRQ.

So use 0 instead of using NO_IRQ.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 drivers/iommu/fsl_pamu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
index 0d03f837a5d4..1b53d2da2c19 100644
--- a/drivers/iommu/fsl_pamu.c
+++ b/drivers/iommu/fsl_pamu.c
@@ -779,7 +779,7 @@ static int fsl_pamu_probe(struct platform_device *pdev)
 	of_get_address(dev->of_node, 0, &size, NULL);
 
 	irq = irq_of_parse_and_map(dev->of_node, 0);
-	if (irq == NO_IRQ) {
+	if (!irq) {
 		dev_warn(dev, "no interrupts listed in PAMU node\n");
 		goto error;
 	}
@@ -903,7 +903,7 @@ static int fsl_pamu_probe(struct platform_device *pdev)
 	return 0;
 
 error:
-	if (irq != NO_IRQ)
+	if (irq)
 		free_irq(irq, data);
 
 	kfree_sensitive(data);
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu: fsl_pamu: Replace NO_IRQ by 0
  2022-10-06  5:24 [PATCH] iommu: fsl_pamu: Replace NO_IRQ by 0 Christophe Leroy
@ 2022-10-06 10:34 ` Robin Murphy
  2022-11-03 13:45 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Robin Murphy @ 2022-10-06 10:34 UTC (permalink / raw)
  To: Christophe Leroy, Joerg Roedel, Will Deacon; +Cc: linux-kernel, iommu

On 2022-10-06 06:24, Christophe Leroy wrote:
> NO_IRQ is used to check the return of irq_of_parse_and_map().
> 
> On some architecture NO_IRQ is 0, on other architectures it is -1.
> 
> irq_of_parse_and_map() returns 0 on error, independent of NO_IRQ.
> 
> So use 0 instead of using NO_IRQ.

Crucially, NO_IRQ *is* 0 on PowerPC where this driver actually runs, so 
there's no functional issue here. However the justification for cleaning 
it up makes perfect sense overall.

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>   drivers/iommu/fsl_pamu.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
> index 0d03f837a5d4..1b53d2da2c19 100644
> --- a/drivers/iommu/fsl_pamu.c
> +++ b/drivers/iommu/fsl_pamu.c
> @@ -779,7 +779,7 @@ static int fsl_pamu_probe(struct platform_device *pdev)
>   	of_get_address(dev->of_node, 0, &size, NULL);
>   
>   	irq = irq_of_parse_and_map(dev->of_node, 0);
> -	if (irq == NO_IRQ) {
> +	if (!irq) {
>   		dev_warn(dev, "no interrupts listed in PAMU node\n");
>   		goto error;
>   	}
> @@ -903,7 +903,7 @@ static int fsl_pamu_probe(struct platform_device *pdev)
>   	return 0;
>   
>   error:
> -	if (irq != NO_IRQ)
> +	if (irq)
>   		free_irq(irq, data);
>   
>   	kfree_sensitive(data);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iommu: fsl_pamu: Replace NO_IRQ by 0
  2022-10-06  5:24 [PATCH] iommu: fsl_pamu: Replace NO_IRQ by 0 Christophe Leroy
  2022-10-06 10:34 ` Robin Murphy
@ 2022-11-03 13:45 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2022-11-03 13:45 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: Will Deacon, Robin Murphy, linux-kernel, iommu

On Thu, Oct 06, 2022 at 07:24:03AM +0200, Christophe Leroy wrote:
>  drivers/iommu/fsl_pamu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-03 13:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06  5:24 [PATCH] iommu: fsl_pamu: Replace NO_IRQ by 0 Christophe Leroy
2022-10-06 10:34 ` Robin Murphy
2022-11-03 13:45 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).