Message ID | 1392468635-13373-2-git-send-email-festevam@gmail.com |
---|---|
State | Not Applicable |
Delegated to: | David Miller |
Headers | show |
Hello. On 15-02-2014 16:50, Fabio Estevam wrote: > From: Fabio Estevam <fabio.estevam@freescale.com> > No need to return a 'fake' return value on platform_get_irq() failure. > Just return the error code itself instead. > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> > --- > drivers/ata/pata_imx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c > index 50e2cf2..1af71b7 100644 > --- a/drivers/ata/pata_imx.c > +++ b/drivers/ata/pata_imx.c > @@ -101,7 +101,7 @@ static int pata_imx_probe(struct platform_device *pdev) > > irq = platform_get_irq(pdev, 0); > if (irq <= 0) > - return -EINVAL; > + return irq; If returned IRQ is 0 (unused), you'll return 0, indicating probe success while actually it failed. We need somewhat more complicated code here. WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat, Feb 15, 2014 at 6:38 PM, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote: >> irq = platform_get_irq(pdev, 0); >> if (irq <= 0) >> - return -EINVAL; >> + return irq; > > > If returned IRQ is 0 (unused), you'll return 0, indicating probe success > while actually it failed. We need somewhat more complicated code here. Right, then we should do this instead: irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; Regards, Fabio Estevam -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello. On 02/17/2014 10:48 PM, Fabio Estevam wrote: >>> irq = platform_get_irq(pdev, 0); >>> if (irq <= 0) >>> - return -EINVAL; >>> + return irq; >> If returned IRQ is 0 (unused), you'll return 0, indicating probe success >> while actually it failed. We need somewhat more complicated code here. > Right, then we should do this instead: > irq = platform_get_irq(pdev, 0); > if (irq < 0) > return irq; Yes, but don't forget that 0 is not considered a valid IRQ either. Ask Linus why. ;-) > Regards, > Fabio Estevam WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c index 50e2cf2..1af71b7 100644 --- a/drivers/ata/pata_imx.c +++ b/drivers/ata/pata_imx.c @@ -101,7 +101,7 @@ static int pata_imx_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq <= 0) - return -EINVAL; + return irq; priv = devm_kzalloc(&pdev->dev, sizeof(struct pata_imx_priv), GFP_KERNEL);