netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: netdev@vger.kernel.org, andrew@lunn.ch, linux@armlinux.org.uk,
	jarkko.nikula@linux.intel.com, olteanv@gmail.com,
	andriy.shevchenko@linux.intel.com, hkallweit1@gmail.com,
	linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org,
	mengyuanlou@net-swift.com
Subject: Re: [PATCH net-next v4 1/8] net: txgbe: Add software nodes to support phylink
Date: Sun, 23 Apr 2023 21:47:25 +0200	[thread overview]
Message-ID: <ZEWLTW0GbpRDaxZR@corigine.com> (raw)
In-Reply-To: <20230422045621.360918-2-jiawenwu@trustnetic.com>

On Sat, Apr 22, 2023 at 12:56:14PM +0800, Jiawen Wu wrote:
> Register software nodes for GPIO, I2C, SFP and PHYLINK. Define the
> device properties.
> 
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>

...

> @@ -513,6 +514,7 @@ static int txgbe_probe(struct pci_dev *pdev,
>  	struct net_device *netdev;
>  	int err, expected_gts;
>  	struct wx *wx = NULL;
> +	struct txgbe *txgbe;
>  
>  	u16 eeprom_verh = 0, eeprom_verl = 0, offset = 0;
>  	u16 eeprom_cfg_blkh = 0, eeprom_cfg_blkl = 0;
> @@ -663,10 +665,21 @@ static int txgbe_probe(struct pci_dev *pdev,
>  			 "0x%08x", etrack_id);
>  	}
>  
> -	err = register_netdev(netdev);
> +	txgbe = devm_kzalloc(&pdev->dev, sizeof(*txgbe), GFP_KERNEL);
> +	if (!txgbe)
> +		return -ENOMEM;

Hi Jiawen,

I strongly suspect this needs to be a goto to unwind.
Probably goto err_release_hw.

> +
> +	txgbe->wx = wx;
> +	wx->priv = txgbe;
> +
> +	err = txgbe_init_phy(txgbe);
>  	if (err)
>  		goto err_release_hw;
>  
> +	err = register_netdev(netdev);
> +	if (err)
> +		goto err_remove_phy;
> +
>  	pci_set_drvdata(pdev, wx);
>  
>  	netif_tx_stop_all_queues(netdev);
> @@ -694,6 +707,8 @@ static int txgbe_probe(struct pci_dev *pdev,
>  
>  	return 0;
>  
> +err_remove_phy:
> +	txgbe_remove_phy(txgbe);
>  err_release_hw:
>  	wx_clear_interrupt_scheme(wx);
>  	wx_control_hw(wx, false);

...

  reply	other threads:[~2023-04-23 19:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-22  4:56 [PATCH net-next v4 0/8] TXGBE PHYLINK support Jiawen Wu
2023-04-22  4:56 ` [PATCH net-next v4 1/8] net: txgbe: Add software nodes to support phylink Jiawen Wu
2023-04-23 19:47   ` Simon Horman [this message]
2023-04-22  4:56 ` [PATCH net-next v4 2/8] i2c: designware: Add driver support for Wangxun 10Gb NIC Jiawen Wu
2023-04-22 16:25   ` Andy Shevchenko
2023-04-23  2:31     ` Jiawen Wu
2023-04-24 13:28       ` 'Andy Shevchenko'
2023-04-24  2:39     ` Jiawen Wu
2023-04-25 14:08     ` Andi Shyti
2023-05-01 18:28       ` Andy Shevchenko
2023-04-22  4:56 ` [PATCH net-next v4 3/8] net: txgbe: Register I2C platform device Jiawen Wu
2023-04-25 15:06   ` Andi Shyti
2023-04-25 15:16     ` Andi Shyti
2023-04-22  4:56 ` [PATCH net-next v4 4/8] net: txgbe: Add SFP module identify Jiawen Wu
2023-04-22  4:56 ` [PATCH net-next v4 5/8] net: txgbe: Support GPIO to SFP socket Jiawen Wu
2023-04-22  4:56 ` [PATCH net-next v4 6/8] net: pcs: Add 10GBASE-R mode for Synopsys Designware XPCS Jiawen Wu
2023-05-02  8:01   ` Russell King (Oracle)
2023-04-22  4:56 ` [PATCH net-next v4 7/8] net: txgbe: Implement phylink pcs Jiawen Wu
2023-04-22  4:56 ` [PATCH net-next v4 8/8] net: txgbe: Support phylink MAC layer Jiawen Wu
2023-04-23 19:57   ` Simon Horman
2023-04-24  1:49     ` Jiawen Wu

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=ZEWLTW0GbpRDaxZR@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=andrew@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hkallweit1@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.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;
as well as URLs for NNTP newsgroup(s).