diff mbox

[03/19] libata: samsung_cf: fix handling platform_get_irq result

Message ID 1443103227-25612-4-git-send-email-a.hajda@samsung.com
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Andrzej Hajda Sept. 24, 2015, 2 p.m. UTC
The function can return negative value.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
Hi,

To avoid problems with too many mail recipients I have sent whole
patchset only to LKML. Anyway patches have no dependencies.

Regards
Andrzej
---
 drivers/ata/pata_samsung_cf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Tejun Heo Sept. 24, 2015, 2:53 p.m. UTC | #1
On Thu, Sep 24, 2015 at 04:00:11PM +0200, Andrzej Hajda wrote:
> The function can return negative value.
> 
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
> 
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
> 
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
> Hi,
> 
> To avoid problems with too many mail recipients I have sent whole
> patchset only to LKML. Anyway patches have no dependencies.

Can we just change s3c_ide_info->irq to int instead?

Thanks.
diff mbox

Patch

diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c
index cbb5a47..e028763 100644
--- a/drivers/ata/pata_samsung_cf.c
+++ b/drivers/ata/pata_samsung_cf.c
@@ -510,8 +510,6 @@  static int __init pata_s3c_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	info->irq = platform_get_irq(pdev, 0);
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
 	info->ide_addr = devm_ioremap_resource(dev, res);
@@ -551,9 +549,10 @@  static int __init pata_s3c_probe(struct platform_device *pdev)
 
 	info->cpu_type = cpu_type;
 
+	ret = platform_get_irq(pdev, 0);
+	info->irq = ret > 0 ? ret : 0;
 	if (info->irq <= 0) {
 		ap->flags |= ATA_FLAG_PIO_POLLING;
-		info->irq = 0;
 		ata_port_desc(ap, "no IRQ, using PIO polling\n");
 	}