[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZEWLTW0GbpRDaxZR@corigine.com>
Date: Sun, 23 Apr 2023 21:47:25 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Jiawen Wu <jiawenwu@...stnetic.com>
Cc: netdev@...r.kernel.org, andrew@...n.ch, linux@...linux.org.uk,
jarkko.nikula@...ux.intel.com, olteanv@...il.com,
andriy.shevchenko@...ux.intel.com, hkallweit1@...il.com,
linux-i2c@...r.kernel.org, linux-gpio@...r.kernel.org,
mengyuanlou@...-swift.com
Subject: Re: [PATCH net-next v4 1/8] net: txgbe: Add software nodes to
support phylink
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@...stnetic.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);
...
Powered by blists - more mailing lists