All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: fsl-imx25: fix check for platform_get_irq() errors
@ 2022-08-11 10:53 Dan Carpenter
  2022-08-11 12:29 ` Martin Kaiser
  2022-09-08  7:38 ` Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-08-11 10:53 UTC (permalink / raw)
  To: Lee Jones, Martin Kaiser
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Lucas Stach, linux-kernel, kernel-janitors

The mx25_tsadc_remove() function assumes all non-zero returns are success
but the platform_get_irq() function returns negative on error and
positive non-zero values on success.  It never returns zero, but if it
did then treat that as a success.

Fixes: 18f773937968 ("mfd: fsl-imx25: Clean up irq settings during removal")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/mfd/fsl-imx25-tsadc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c
index 37e5e02a1d05..dfc6da9b4aec 100644
--- a/drivers/mfd/fsl-imx25-tsadc.c
+++ b/drivers/mfd/fsl-imx25-tsadc.c
@@ -69,7 +69,7 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev,
 	int irq;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0)
+	if (irq < 0)
 		return irq;
 
 	tsadc->domain = irq_domain_add_simple(np, 2, 0, &mx25_tsadc_domain_ops,
@@ -179,7 +179,7 @@ static int mx25_tsadc_remove(struct platform_device *pdev)
 	struct mx25_tsadc *tsadc = platform_get_drvdata(pdev);
 	int irq = platform_get_irq(pdev, 0);
 
-	if (irq) {
+	if (irq >= 0) {
 		irq_set_chained_handler_and_data(irq, NULL, NULL);
 		irq_domain_remove(tsadc->domain);
 	}
-- 
2.35.1


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

* Re: [PATCH] mfd: fsl-imx25: fix check for platform_get_irq() errors
  2022-08-11 10:53 [PATCH] mfd: fsl-imx25: fix check for platform_get_irq() errors Dan Carpenter
@ 2022-08-11 12:29 ` Martin Kaiser
  2022-09-08  7:38 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Kaiser @ 2022-08-11 12:29 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Lee Jones, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Lucas Stach, linux-kernel,
	kernel-janitors

Thus wrote Dan Carpenter (dan.carpenter@oracle.com):

> The mx25_tsadc_remove() function assumes all non-zero returns are success
> but the platform_get_irq() function returns negative on error and
> positive non-zero values on success.  It never returns zero, but if it
> did then treat that as a success.

> Fixes: 18f773937968 ("mfd: fsl-imx25: Clean up irq settings during removal")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/mfd/fsl-imx25-tsadc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

> diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c
> index 37e5e02a1d05..dfc6da9b4aec 100644
> --- a/drivers/mfd/fsl-imx25-tsadc.c
> +++ b/drivers/mfd/fsl-imx25-tsadc.c
> @@ -69,7 +69,7 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev,
>  	int irq;

>  	irq = platform_get_irq(pdev, 0);
> -	if (irq <= 0)
> +	if (irq < 0)
>  		return irq;

>  	tsadc->domain = irq_domain_add_simple(np, 2, 0, &mx25_tsadc_domain_ops,
> @@ -179,7 +179,7 @@ static int mx25_tsadc_remove(struct platform_device *pdev)
>  	struct mx25_tsadc *tsadc = platform_get_drvdata(pdev);
>  	int irq = platform_get_irq(pdev, 0);

> -	if (irq) {
> +	if (irq >= 0) {
>  		irq_set_chained_handler_and_data(irq, NULL, NULL);
>  		irq_domain_remove(tsadc->domain);
>  	}
> -- 
> 2.35.1

Reviewed-by: Martin Kaiser <martin@kaiser.cx>

Thanks,

   Martin

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

* Re: [PATCH] mfd: fsl-imx25: fix check for platform_get_irq() errors
  2022-08-11 10:53 [PATCH] mfd: fsl-imx25: fix check for platform_get_irq() errors Dan Carpenter
  2022-08-11 12:29 ` Martin Kaiser
@ 2022-09-08  7:38 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2022-09-08  7:38 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Martin Kaiser, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Lucas Stach, linux-kernel,
	kernel-janitors

On Thu, 11 Aug 2022, Dan Carpenter wrote:

> The mx25_tsadc_remove() function assumes all non-zero returns are success
> but the platform_get_irq() function returns negative on error and
> positive non-zero values on success.  It never returns zero, but if it
> did then treat that as a success.
> 
> Fixes: 18f773937968 ("mfd: fsl-imx25: Clean up irq settings during removal")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/mfd/fsl-imx25-tsadc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]

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

end of thread, other threads:[~2022-09-08  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 10:53 [PATCH] mfd: fsl-imx25: fix check for platform_get_irq() errors Dan Carpenter
2022-08-11 12:29 ` Martin Kaiser
2022-09-08  7:38 ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.