From: Andrew Lunn <andrew@lunn.ch>
To: Richard Cochran <richardcochran@gmail.com>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
devicetree@vger.kernel.org,
Florian Fainelli <f.fainelli@gmail.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Mark Rutland <mark.rutland@arm.com>,
Miroslav Lichvar <mlichvar@redhat.com>,
Rob Herring <robh+dt@kernel.org>,
Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH V3 net-next 5/6] net: mdio: of: Register discovered MII time stampers.
Date: Wed, 22 May 2019 03:22:27 +0200 [thread overview]
Message-ID: <20190522012227.GA734@lunn.ch> (raw)
In-Reply-To: <20190521224723.6116-6-richardcochran@gmail.com>
> +struct mii_timestamper *of_find_mii_timestamper(struct device_node *node)
> +{
> + struct of_phandle_args arg;
> + int err;
> +
> + err = of_parse_phandle_with_fixed_args(node, "timestamper", 1, 0, &arg);
> +
> + if (err == -ENOENT)
> + return NULL;
> + else if (err)
> + return ERR_PTR(err);
> +
> + if (arg.args_count != 1)
> + return ERR_PTR(-EINVAL);
> +
> + return register_mii_timestamper(arg.np, arg.args[0]);
> +}
> +
> static int of_mdiobus_register_phy(struct mii_bus *mdio,
> struct device_node *child, u32 addr)
> {
> + struct mii_timestamper *mii_ts;
> struct phy_device *phy;
> bool is_c45;
> int rc;
> u32 phy_id;
>
> + mii_ts = of_find_mii_timestamper(child);
> + if (IS_ERR(mii_ts))
> + return PTR_ERR(mii_ts);
> +
> is_c45 = of_device_is_compatible(child,
> "ethernet-phy-ieee802.3-c45");
>
Hi Richard
There can be errors after this, e.g. of_irq_get() returns
-EPROBE_DEFER, or from phy_device_register().
Shouldn't unregister_mii_timestamper() be called on error?
Andrew
next prev parent reply other threads:[~2019-05-22 1:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 22:47 [PATCH V3 net-next 5/6] net: mdio: of: Register discovered MII time stampers Richard Cochran
2019-05-22 1:22 ` Andrew Lunn [this message]
2019-05-28 5:21 ` Richard Cochran
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=20190522012227.GA734@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=jacob.e.keller@intel.com \
--cc=mark.rutland@arm.com \
--cc=mlichvar@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=robh+dt@kernel.org \
--cc=willemb@google.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).