linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return
@ 2017-11-17 20:28 Arvind Yadav
  2017-11-17 20:28 ` [PATCH 1/6] mmc: meson-gx-mmc: Fix platform_get_irq's error checking Arvind Yadav
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:28 UTC (permalink / raw)
  To: linux-arm-kernel

The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct and and we must check its return value.

Arvind Yadav (6):
  [PATCH 1/6] mmc: meson-gx-mmc: Fix platform_get_irq's error checking
  [PATCH 2/6] mmc: s3cmci: Fix platform_get_irq's error checking
  [PATCH 3/6] mmc: sdhci-acpi: Handle return value of platform_get_irq
  [PATCH 4/6] mmc: sdhci-spear: Handle return value of platform_get_irq
  [PATCH 5/6] mmc: sh_mmcif: Handle return value of platform_get_irq
  [PATCH 6/6] mmc: sunxi-mmc: Handle return value of platform_get_irq

 drivers/mmc/host/meson-gx-mmc.c | 4 ++--
 drivers/mmc/host/s3cmci.c       | 4 ++--
 drivers/mmc/host/sdhci-acpi.c   | 4 ++++
 drivers/mmc/host/sdhci-spear.c  | 4 ++++
 drivers/mmc/host/sh_mmcif.c     | 2 +-
 drivers/mmc/host/sunxi-mmc.c    | 5 +++++
 6 files changed, 18 insertions(+), 5 deletions(-)

-- 
2.7.4

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

* [PATCH 1/6] mmc: meson-gx-mmc: Fix platform_get_irq's error checking
  2017-11-17 20:28 [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Arvind Yadav
@ 2017-11-17 20:28 ` Arvind Yadav
  2017-12-07  0:55   ` Kevin Hilman
  2017-11-17 20:28 ` [PATCH 2/6] mmc: s3cmci: " Arvind Yadav
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:28 UTC (permalink / raw)
  To: linux-arm-kernel

The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/mmc/host/meson-gx-mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index e0862d3..d6a0695 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1208,9 +1208,9 @@ static int meson_mmc_probe(struct platform_device *pdev)
 	}
 
 	irq = platform_get_irq(pdev, 0);
-	if (!irq) {
+	if (irq < 0) {
 		dev_err(&pdev->dev, "failed to get interrupt resource.\n");
-		ret = -EINVAL;
+		ret = irq;
 		goto free_host;
 	}
 
-- 
2.7.4

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

* [PATCH 2/6] mmc: s3cmci: Fix platform_get_irq's error checking
  2017-11-17 20:28 [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Arvind Yadav
  2017-11-17 20:28 ` [PATCH 1/6] mmc: meson-gx-mmc: Fix platform_get_irq's error checking Arvind Yadav
@ 2017-11-17 20:28 ` Arvind Yadav
  2017-11-17 20:28 ` [PATCH 3/6] mmc: sdhci-acpi: Handle return value of platform_get_irq Arvind Yadav
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:28 UTC (permalink / raw)
  To: linux-arm-kernel

The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/mmc/host/s3cmci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
index f7f157a..cc801bc 100644
--- a/drivers/mmc/host/s3cmci.c
+++ b/drivers/mmc/host/s3cmci.c
@@ -1658,9 +1658,9 @@ static int s3cmci_probe(struct platform_device *pdev)
 	}
 
 	host->irq = platform_get_irq(pdev, 0);
-	if (host->irq == 0) {
+	if (host->irq < 0) {
 		dev_err(&pdev->dev, "failed to get interrupt resource.\n");
-		ret = -EINVAL;
+		ret = host->irq;
 		goto probe_iounmap;
 	}
 
-- 
2.7.4

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

* [PATCH 3/6] mmc: sdhci-acpi: Handle return value of platform_get_irq
  2017-11-17 20:28 [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Arvind Yadav
  2017-11-17 20:28 ` [PATCH 1/6] mmc: meson-gx-mmc: Fix platform_get_irq's error checking Arvind Yadav
  2017-11-17 20:28 ` [PATCH 2/6] mmc: s3cmci: " Arvind Yadav
@ 2017-11-17 20:28 ` Arvind Yadav
  2017-11-17 20:28 ` [PATCH 4/6] mmc: sdhci-spear: " Arvind Yadav
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:28 UTC (permalink / raw)
  To: linux-arm-kernel

platform_get_irq() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/mmc/host/sdhci-acpi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index b988997..dd8129e 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -566,6 +566,10 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
 	host->hw_name	= "ACPI";
 	host->ops	= &sdhci_acpi_ops_dflt;
 	host->irq	= platform_get_irq(pdev, 0);
+	if (host->irq < 0) {
+		err = host->irq;
+		goto err_free;
+	}
 
 	host->ioaddr = devm_ioremap_nocache(dev, iomem->start,
 					    resource_size(iomem));
-- 
2.7.4

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

* [PATCH 4/6] mmc: sdhci-spear: Handle return value of platform_get_irq
  2017-11-17 20:28 [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Arvind Yadav
                   ` (2 preceding siblings ...)
  2017-11-17 20:28 ` [PATCH 3/6] mmc: sdhci-acpi: Handle return value of platform_get_irq Arvind Yadav
@ 2017-11-17 20:28 ` Arvind Yadav
  2017-11-20  5:43   ` Viresh Kumar
  2017-11-17 20:28 ` [PATCH 5/6] mmc: sh_mmcif: " Arvind Yadav
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:28 UTC (permalink / raw)
  To: linux-arm-kernel

platform_get_irq() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/mmc/host/sdhci-spear.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 8c0f884..900838b 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -82,6 +82,10 @@ static int sdhci_probe(struct platform_device *pdev)
 	host->hw_name = "sdhci";
 	host->ops = &sdhci_pltfm_ops;
 	host->irq = platform_get_irq(pdev, 0);
+	if (host->irq < 0) {
+		ret = host->irq;
+		goto err_host;
+	}
 	host->quirks = SDHCI_QUIRK_BROKEN_ADMA;
 
 	sdhci = sdhci_priv(host);
-- 
2.7.4

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

* [PATCH 5/6] mmc: sh_mmcif: Handle return value of platform_get_irq
  2017-11-17 20:28 [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Arvind Yadav
                   ` (3 preceding siblings ...)
  2017-11-17 20:28 ` [PATCH 4/6] mmc: sdhci-spear: " Arvind Yadav
@ 2017-11-17 20:28 ` Arvind Yadav
  2017-11-17 20:28 ` [PATCH 6/6] mmc: sunxi-mmc: " Arvind Yadav
  2017-11-18  8:19 ` [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Russell King - ARM Linux
  6 siblings, 0 replies; 11+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:28 UTC (permalink / raw)
  To: linux-arm-kernel

platform_get_irq() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/mmc/host/sh_mmcif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 53fb18b..481f2c4 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1405,7 +1405,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 
 	irq[0] = platform_get_irq(pdev, 0);
 	irq[1] = platform_get_irq(pdev, 1);
-	if (irq[0] < 0) {
+	if (irq[0] < 0 || irq[1] < 0) {
 		dev_err(dev, "Get irq error\n");
 		return -ENXIO;
 	}
-- 
2.7.4

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

* [PATCH 6/6] mmc: sunxi-mmc: Handle return value of platform_get_irq
  2017-11-17 20:28 [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Arvind Yadav
                   ` (4 preceding siblings ...)
  2017-11-17 20:28 ` [PATCH 5/6] mmc: sh_mmcif: " Arvind Yadav
@ 2017-11-17 20:28 ` Arvind Yadav
  2017-11-18  8:19 ` [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Russell King - ARM Linux
  6 siblings, 0 replies; 11+ messages in thread
From: Arvind Yadav @ 2017-11-17 20:28 UTC (permalink / raw)
  To: linux-arm-kernel

platform_get_irq() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/mmc/host/sunxi-mmc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index cc98355d..ec2a16b 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1255,6 +1255,11 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
 		goto error_assert_reset;
 
 	host->irq = platform_get_irq(pdev, 0);
+	if (host->irq < 0) {
+		ret = host->irq;
+		goto error_assert_reset;
+	}
+
 	return devm_request_threaded_irq(&pdev->dev, host->irq, sunxi_mmc_irq,
 			sunxi_mmc_handle_manual_stop, 0, "sunxi-mmc", host);
 
-- 
2.7.4

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

* [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return
  2017-11-17 20:28 [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Arvind Yadav
                   ` (5 preceding siblings ...)
  2017-11-17 20:28 ` [PATCH 6/6] mmc: sunxi-mmc: " Arvind Yadav
@ 2017-11-18  8:19 ` Russell King - ARM Linux
  6 siblings, 0 replies; 11+ messages in thread
From: Russell King - ARM Linux @ 2017-11-18  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 18, 2017 at 01:58:16AM +0530, Arvind Yadav wrote:
> The platform_get_irq() function returns negative if an error occurs.
> zero or positive number on success. platform_get_irq() error checking
> for zero is not correct and and we must check its return value.

IRQ 0 is not a valid interrupt.  The correct test here is <= 0.
Please rework your patches for this.

Thanks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync@8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

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

* [PATCH 4/6] mmc: sdhci-spear: Handle return value of platform_get_irq
  2017-11-17 20:28 ` [PATCH 4/6] mmc: sdhci-spear: " Arvind Yadav
@ 2017-11-20  5:43   ` Viresh Kumar
  2017-11-20  6:43     ` Arvind Yadav
  0 siblings, 1 reply; 11+ messages in thread
From: Viresh Kumar @ 2017-11-20  5:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 18-11-17, 01:58, Arvind Yadav wrote:
> platform_get_irq() can fail here and we must check its return value.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/mmc/host/sdhci-spear.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
> index 8c0f884..900838b 100644
> --- a/drivers/mmc/host/sdhci-spear.c
> +++ b/drivers/mmc/host/sdhci-spear.c
> @@ -82,6 +82,10 @@ static int sdhci_probe(struct platform_device *pdev)
>  	host->hw_name = "sdhci";
>  	host->ops = &sdhci_pltfm_ops;
>  	host->irq = platform_get_irq(pdev, 0);
> +	if (host->irq < 0) {
> +		ret = host->irq;
> +		goto err_host;
> +	}
>  	host->quirks = SDHCI_QUIRK_BROKEN_ADMA;
>  
>  	sdhci = sdhci_priv(host);

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

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

* [PATCH 4/6] mmc: sdhci-spear: Handle return value of platform_get_irq
  2017-11-20  5:43   ` Viresh Kumar
@ 2017-11-20  6:43     ` Arvind Yadav
  0 siblings, 0 replies; 11+ messages in thread
From: Arvind Yadav @ 2017-11-20  6:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi viresh,

Could you please acknowledge a latest version of this patch.

Thanks,


On Monday 20 November 2017 11:13 AM, Viresh Kumar wrote:
> On 18-11-17, 01:58, Arvind Yadav wrote:
>> platform_get_irq() can fail here and we must check its return value.
>>
>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>> ---
>>   drivers/mmc/host/sdhci-spear.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
>> index 8c0f884..900838b 100644
>> --- a/drivers/mmc/host/sdhci-spear.c
>> +++ b/drivers/mmc/host/sdhci-spear.c
>> @@ -82,6 +82,10 @@ static int sdhci_probe(struct platform_device *pdev)
>>   	host->hw_name = "sdhci";
>>   	host->ops = &sdhci_pltfm_ops;
>>   	host->irq = platform_get_irq(pdev, 0);
>> +	if (host->irq < 0) {
>> +		ret = host->irq;
>> +		goto err_host;
>> +	}
>>   	host->quirks = SDHCI_QUIRK_BROKEN_ADMA;
>>   
>>   	sdhci = sdhci_priv(host);
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
>

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

* [PATCH 1/6] mmc: meson-gx-mmc: Fix platform_get_irq's error checking
  2017-11-17 20:28 ` [PATCH 1/6] mmc: meson-gx-mmc: Fix platform_get_irq's error checking Arvind Yadav
@ 2017-12-07  0:55   ` Kevin Hilman
  0 siblings, 0 replies; 11+ messages in thread
From: Kevin Hilman @ 2017-12-07  0:55 UTC (permalink / raw)
  To: linux-arm-kernel

Arvind Yadav <arvind.yadav.cs@gmail.com> writes:

> The platform_get_irq() function returns negative if an error occurs.
> zero or positive number on success. platform_get_irq() error checking
> for zero is not correct.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

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

end of thread, other threads:[~2017-12-07  0:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-17 20:28 [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Arvind Yadav
2017-11-17 20:28 ` [PATCH 1/6] mmc: meson-gx-mmc: Fix platform_get_irq's error checking Arvind Yadav
2017-12-07  0:55   ` Kevin Hilman
2017-11-17 20:28 ` [PATCH 2/6] mmc: s3cmci: " Arvind Yadav
2017-11-17 20:28 ` [PATCH 3/6] mmc: sdhci-acpi: Handle return value of platform_get_irq Arvind Yadav
2017-11-17 20:28 ` [PATCH 4/6] mmc: sdhci-spear: " Arvind Yadav
2017-11-20  5:43   ` Viresh Kumar
2017-11-20  6:43     ` Arvind Yadav
2017-11-17 20:28 ` [PATCH 5/6] mmc: sh_mmcif: " Arvind Yadav
2017-11-17 20:28 ` [PATCH 6/6] mmc: sunxi-mmc: " Arvind Yadav
2017-11-18  8:19 ` [PATCH 0/6] mmc: Handle platform_get_irq's error checking and return Russell King - ARM Linux

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).