From: Francois Romieu <romieu@fr.zoreil.com>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
linux-kernel@vger.kernel.org,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Subject: Re: [PATCH v2] net: ethernet: davicom: fix devicetree irq resource
Date: Sun, 7 Feb 2016 11:23:03 +0100 [thread overview]
Message-ID: <20160207102303.GA4976@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <1454796693-4446-1-git-send-email-robert.jarzmik@free.fr>
Robert Jarzmik <robert.jarzmik@free.fr> :
[...]
> diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
> index cf94b72dbacd..2bae5c8c1f85 100644
> --- a/drivers/net/ethernet/davicom/dm9000.c
> +++ b/drivers/net/ethernet/davicom/dm9000.c
[...]
> @@ -1500,15 +1496,21 @@ dm9000_probe(struct platform_device *pdev)
>
> db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> - db->irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>
> - if (db->addr_res == NULL || db->data_res == NULL ||
> - db->irq_res == NULL) {
> - dev_err(db->dev, "insufficient resources\n");
> + if (!db->addr_res || !db->data_res) {
> + dev_err(db->dev, "insufficient resources addr=%p data=%p\n",
> + db->addr_res, db->data_res);
> ret = -ENOENT;
> goto out;
> }
>
> + ndev->irq = platform_get_irq(pdev, 0);
> + if (ndev->irq < 0) {
> + dev_err(db->dev, "interrupt resource unavailable: %d\n",
> + ndev->irq);
> + return ndev->irq;
> + }
> +
Leak: please set 'ret = ndev->irq;' and proceed to the 'out' label.
If you have some spare time, it would be nice to avoid db->irq_wake leak
on probe failure or driver removal.
--
Ueimor
next prev parent reply other threads:[~2016-02-07 10:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-06 22:11 [PATCH v2] net: ethernet: davicom: fix devicetree irq resource Robert Jarzmik
2016-02-07 10:23 ` Francois Romieu [this message]
2016-02-07 10:46 ` Robert Jarzmik
2016-02-07 12:34 ` Francois Romieu
2016-02-07 10:49 ` Sergei Shtylyov
2016-02-07 11:47 ` Robert Jarzmik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160207102303.GA4976@electric-eye.fr.zoreil.com \
--to=romieu@fr.zoreil.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=robert.jarzmik@free.fr \
--cc=sergei.shtylyov@cogentembedded.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox