netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: netdev@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Heiner Kallweit <hkallweit1@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH v2 2/2] net: phy: mscc-miim: Move the setting of mii_bus structure members in mscc_miim_probe()
Date: Fri, 27 Sep 2019 10:18:27 +0200	[thread overview]
Message-ID: <70ec73ad-19aa-76aa-168b-b9a2a6911938@web.de> (raw)
In-Reply-To: <8fbfa9ad-182a-e2ce-e91f-7350523e33c7@web.de>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 27 Sep 2019 09:30:14 +0200

Move the modification of some members in the data structure “mii_bus”
for the local variable “bus” directly before the call of
the function “of_mdiobus_register” so that this change will be performed
only after previous resource allocations succeeded.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---

v2:
This suggestion was repeated based on the change for the previous update step.


 drivers/net/phy/mdio-mscc-miim.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/phy/mdio-mscc-miim.c b/drivers/net/phy/mdio-mscc-miim.c
index aabb13982251..a270f83bb207 100644
--- a/drivers/net/phy/mdio-mscc-miim.c
+++ b/drivers/net/phy/mdio-mscc-miim.c
@@ -124,13 +124,6 @@ static int mscc_miim_probe(struct platform_device *pdev)
 	if (!bus)
 		return -ENOMEM;

-	bus->name = "mscc_miim";
-	bus->read = mscc_miim_read;
-	bus->write = mscc_miim_write;
-	bus->reset = mscc_miim_reset;
-	snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev));
-	bus->parent = &pdev->dev;
-
 	dev = bus->priv;
 	dev->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dev->regs)) {
@@ -147,6 +140,12 @@ static int mscc_miim_probe(struct platform_device *pdev)
 		}
 	}

+	bus->name = "mscc_miim";
+	bus->read = mscc_miim_read;
+	bus->write = mscc_miim_write;
+	bus->reset = mscc_miim_reset;
+	snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev));
+	bus->parent = &pdev->dev;
 	ret = of_mdiobus_register(bus, pdev->dev.of_node);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
--
2.23.0


  parent reply	other threads:[~2019-09-27  8:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20 19:00 [PATCH 0/2] net/phy/mdio-mscc-miim: Adjustments for mscc_miim_probe() Markus Elfring
2019-09-20 19:02 ` [PATCH 1/2] net/phy/mdio-mscc-miim: Use devm_platform_ioremap_resource() in mscc_miim_probe() Markus Elfring
2019-09-20 19:09   ` Andrew Lunn
2019-09-26 15:29     ` [1/2] " Markus Elfring
2019-09-26 16:18       ` Alexandre Belloni
2019-09-26 18:52         ` Markus Elfring
2019-09-26 19:32           ` Alexandre Belloni
2019-09-27  8:14             ` [PATCH v2 0/2] net: phy: mscc-miim: Adjustments for mscc_miim_probe() Markus Elfring
2019-09-27  8:16               ` [PATCH v2 1/2] net: phy: mscc-miim: Use devm_platform_ioremap_resource() in mscc_miim_probe() Markus Elfring
2019-09-27  8:18               ` Markus Elfring [this message]
2019-09-20 19:03 ` [PATCH 2/2] net/phy/mdio-mscc-miim: Move the setting of mii_bus structure members " Markus Elfring
2019-09-20 19:13   ` Andrew Lunn

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=70ec73ad-19aa-76aa-168b-b9a2a6911938@web.de \
    --to=markus.elfring@web.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).