mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ata: libahci_platform: Remove abundant check
@ 2021-12-22  7:24 Jiasheng Jiang
  2021-12-23  0:41 ` Damien Le Moal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiasheng Jiang @ 2021-12-22  7:24 UTC (permalink / raw)
  To: hdegoede, axboe, p.zabel; +Cc: linux-ide, linux-kernel, Jiasheng Jiang

It can be found that platform_get_irq() returns nagative code but not
null when fails.
The comment of the platform_get_irq clearly shows that.
Therefore it should be better to remove the useless check.

Fixes: fd990556f0fa ("ata: move library code from ahci_platform.c to libahci_platform.c")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/ata/libahci_platform.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index b2f552088291..5ec68f138c28 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -587,8 +587,6 @@ int ahci_platform_init_host(struct platform_device *pdev,
 			dev_err(dev, "no irq\n");
 		return irq;
 	}
-	if (!irq)
-		return -EINVAL;
 
 	hpriv->irq = irq;
 
-- 
2.25.1


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

* Re: [PATCH] ata: libahci_platform: Remove abundant check
  2021-12-22  7:24 [PATCH] ata: libahci_platform: Remove abundant check Jiasheng Jiang
@ 2021-12-23  0:41 ` Damien Le Moal
  2021-12-23  0:44 ` Damien Le Moal
  2021-12-23  9:31 ` Sergey Shtylyov
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2021-12-23  0:41 UTC (permalink / raw)
  To: Jiasheng Jiang, hdegoede, axboe, p.zabel; +Cc: linux-ide, linux-kernel

On 12/22/21 16:24, Jiasheng Jiang wrote:
> It can be found that platform_get_irq() returns nagative code but not
> null when fails.
> The comment of the platform_get_irq clearly shows that.
> Therefore it should be better to remove the useless check.

Nope, platform_get_irq() can actually return 0 (the comment for that
function is wrong). So testing for !irq is valid and must be kept.

> 
> Fixes: fd990556f0fa ("ata: move library code from ahci_platform.c to libahci_platform.c")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/ata/libahci_platform.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index b2f552088291..5ec68f138c28 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -587,8 +587,6 @@ int ahci_platform_init_host(struct platform_device *pdev,
>  			dev_err(dev, "no irq\n");
>  		return irq;
>  	}
> -	if (!irq)
> -		return -EINVAL;
>  
>  	hpriv->irq = irq;
>  


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH] ata: libahci_platform: Remove abundant check
  2021-12-22  7:24 [PATCH] ata: libahci_platform: Remove abundant check Jiasheng Jiang
  2021-12-23  0:41 ` Damien Le Moal
@ 2021-12-23  0:44 ` Damien Le Moal
  2021-12-23  9:31 ` Sergey Shtylyov
  2 siblings, 0 replies; 4+ messages in thread
From: Damien Le Moal @ 2021-12-23  0:44 UTC (permalink / raw)
  To: Jiasheng Jiang, hdegoede, axboe, p.zabel; +Cc: linux-ide, linux-kernel

On 12/22/21 16:24, Jiasheng Jiang wrote:
> It can be found that platform_get_irq() returns nagative code but not
> null when fails.
> The comment of the platform_get_irq clearly shows that.
> Therefore it should be better to remove the useless check.
> 
> Fixes: fd990556f0fa ("ata: move library code from ahci_platform.c to libahci_platform.c")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Another note: please use scripts/get_maintainer.pl to see to whom you
should address patches. This one was not addressed to me.

> ---
>  drivers/ata/libahci_platform.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index b2f552088291..5ec68f138c28 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -587,8 +587,6 @@ int ahci_platform_init_host(struct platform_device *pdev,
>  			dev_err(dev, "no irq\n");
>  		return irq;
>  	}
> -	if (!irq)
> -		return -EINVAL;
>  
>  	hpriv->irq = irq;
>  


-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH] ata: libahci_platform: Remove abundant check
  2021-12-22  7:24 [PATCH] ata: libahci_platform: Remove abundant check Jiasheng Jiang
  2021-12-23  0:41 ` Damien Le Moal
  2021-12-23  0:44 ` Damien Le Moal
@ 2021-12-23  9:31 ` Sergey Shtylyov
  2 siblings, 0 replies; 4+ messages in thread
From: Sergey Shtylyov @ 2021-12-23  9:31 UTC (permalink / raw)
  To: Jiasheng Jiang, hdegoede, axboe, p.zabel; +Cc: linux-ide, linux-kernel

Hello!

On 22.12.2021 10:24, Jiasheng Jiang wrote:

> It can be found that platform_get_irq() returns nagative code but not
> null when fails.

    s/null/zero/?

> The comment of the platform_get_irq clearly shows that.

    This comment still doesn't correspond to reality -- 0 can be returned 
(although this would cause a WARN() call)...

> Therefore it should be better to remove the useless check.

    This patch is correct but premature. I have a (not yet merged) patch:

https://marc.info/?l=linux-kernel&m=163623041902285

    It actually disables reporting IRQ0. Until it's merged we have to filter 
out IRQ0 in the libata drivers as libata treats 0 as an indication of the 
polling mode...

> Fixes: fd990556f0fa ("ata: move library code from ahci_platform.c to libahci_platform.c")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
[...]

MBR, Sergey

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

end of thread, other threads:[~2021-12-23  9:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22  7:24 [PATCH] ata: libahci_platform: Remove abundant check Jiasheng Jiang
2021-12-23  0:41 ` Damien Le Moal
2021-12-23  0:44 ` Damien Le Moal
2021-12-23  9:31 ` Sergey Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®