From: Bartosz Golaszewski <brgl@bgdev.pl>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH 02/11] net: ethernet: ixgbe: don't call devm_mdiobus_free()
Date: Mon, 22 Jun 2020 12:00:47 +0200 [thread overview]
Message-ID: <20200622100056.10151-3-brgl@bgdev.pl> (raw)
In-Reply-To: <20200622100056.10151-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The idea behind devres is that the release callbacks are called if
probe fails. As we now check the return value of ixgbe_mii_bus_init(),
we can drop the call devm_mdiobus_free() in error path as the release
callback will be called automatically.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
index 2fb97967961c..7980d7265e10 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -905,7 +905,6 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw)
struct pci_dev *pdev = adapter->pdev;
struct device *dev = &adapter->netdev->dev;
struct mii_bus *bus;
- int err = -ENODEV;
bus = devm_mdiobus_alloc(dev);
if (!bus)
@@ -923,7 +922,7 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw)
case IXGBE_DEV_ID_X550EM_A_1G_T:
case IXGBE_DEV_ID_X550EM_A_1G_T_L:
if (!ixgbe_x550em_a_has_mii(hw))
- goto ixgbe_no_mii_bus;
+ return -ENODEV;
bus->read = &ixgbe_x550em_a_mii_bus_read;
bus->write = &ixgbe_x550em_a_mii_bus_write;
break;
@@ -948,15 +947,8 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw)
*/
hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22;
- err = mdiobus_register(bus);
- if (!err) {
- adapter->mii_bus = bus;
- return 0;
- }
-
-ixgbe_no_mii_bus:
- devm_mdiobus_free(dev, bus);
- return err;
+ adapter->mii_bus = bus;
+ return mdiobus_register(bus);
}
/**
--
2.26.1
next prev parent reply other threads:[~2020-06-22 10:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 10:00 [Intel-wired-lan] [PATCH 00/11] net: improve devres helpers Bartosz Golaszewski
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 01/11] net: ethernet: ixgbe: check the return value of ixgbe_mii_bus_init() Bartosz Golaszewski
2020-06-22 10:00 ` Bartosz Golaszewski [this message]
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 03/11] net: devres: relax devm_register_netdev() Bartosz Golaszewski
2020-06-22 22:49 ` Jakub Kicinski
2020-06-23 9:12 ` Bartosz Golaszewski
2020-06-23 20:16 ` Jakub Kicinski
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 04/11] net: devres: rename the release callback of devm_register_netdev() Bartosz Golaszewski
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 05/11] Documentation: devres: add missing mdio helper Bartosz Golaszewski
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 06/11] phy: un-inline devm_mdiobus_register() Bartosz Golaszewski
2020-06-22 23:55 ` Florian Fainelli
2020-06-25 9:16 ` Bartosz Golaszewski
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 07/11] phy: mdio: add kerneldoc for __devm_mdiobus_register() Bartosz Golaszewski
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 08/11] net: phy: don't abuse devres in devm_mdiobus_register() Bartosz Golaszewski
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 09/11] of: mdio: remove the 'extern' keyword from function declarations Bartosz Golaszewski
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 10/11] of: mdio: provide devm_of_mdiobus_register() Bartosz Golaszewski
2020-06-22 10:00 ` [Intel-wired-lan] [PATCH 11/11] net: ethernet: mtk-star-emac: use devm_of_mdiobus_register() Bartosz Golaszewski
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=20200622100056.10151-3-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=intel-wired-lan@osuosl.org \
/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