All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Byungho An <bh74.an@samsung.com>
Cc: netdev@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	devicetree@vger.kernel.org,
	"'David Miller'" <davem@davemloft.net>,
	"'GIRISH K S'" <ks.giri@samsung.com>,
	"'SIVAREDDY KALLAM'" <siva.kallam@samsung.com>,
	"'Vipul Chandrakant'" <vipul.pandya@samsung.com>,
	"'Ilho Lee'" <ilho215.lee@samsung.com>
Subject: Re: [PATCH V13 2/7] net: sxgbe: add basic framework for Samsung 10Gb ethernet driver
Date: Tue, 25 Mar 2014 00:45:05 +0100	[thread overview]
Message-ID: <20140324234505.GA22059@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <00a001cf46d8$f4c38bd0$de4aa370$@samsung.com>

> +static int sxgbe_platform_probe(struct platform_device *pdev)
[...]
> +	/* Get the SXGBE common INT information */
> +	priv->irq  = irq_of_parse_and_map(node, 0);
> +	if (priv->irq <= 0) {
> +		dev_err(dev, "sxgbe common irq parsing failed\n");
> +		irq_dispose_mapping(priv->irq);
> +		sxgbe_drv_remove(ndev);

sxgbe_drv_probe has not been issued at this point.

> +		return -EINVAL;
> +	}
> +
> +	/* Get the TX/RX IRQ numbers */
> +	for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) {
> +		priv->txq[i]->irq_no = irq_of_parse_and_map(node, chan++);
> +		if (priv->txq[i]->irq_no <= 0) {
> +			dev_err(dev, "sxgbe tx irq parsing failed\n");
> +			irq_dispose_mapping(priv->txq[i]->irq_no);

Releasing the failed irq_no and leaking the i - 1  succeeded ones can't
be right.

> +			sxgbe_drv_remove(ndev);

Sic.

> +			return -EINVAL;
> +		}
> +	}
> +
> +	for (i = 0; i < SXGBE_RX_QUEUES; i++) {
> +		priv->rxq[i]->irq_no = irq_of_parse_and_map(node, chan++);
> +		if (priv->rxq[i]->irq_no <= 0) {
> +			dev_err(dev, "sxgbe rx irq parsing failed\n");
> +			irq_dispose_mapping(priv->rxq[i]->irq_no);
> +			sxgbe_drv_remove(ndev);

Same problem(s) as above + priv->txq[.]->irq_no leak.

Please use goto for the unwind path.

> +			return -EINVAL;
> +		}
> +	}
> +
> +	priv = sxgbe_drv_probe(&(pdev->dev), plat_dat, addr);
> +	if (!priv) {
> +		pr_err("%s: main driver probe failed\n", __func__);
> +		return -ENODEV;

The error path is wrong.

-- 
Ueimor

  reply	other threads:[~2014-03-24 23:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-23 20:46 [PATCH V13 2/7] net: sxgbe: add basic framework for Samsung 10Gb ethernet driver Byungho An
2014-03-24 23:45 ` Francois Romieu [this message]
2014-03-25  3:08   ` Byungho An
2014-03-25  7:05     ` Francois Romieu
2014-03-25 16:09       ` Byungho An

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=20140324234505.GA22059@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=bh74.an@samsung.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=ilho215.lee@samsung.com \
    --cc=ks.giri@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=siva.kallam@samsung.com \
    --cc=vipul.pandya@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.