[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190522012227.GA734@lunn.ch>
Date: Wed, 22 May 2019 03:22:27 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Richard Cochran <richardcochran@...il.com>
Cc: netdev@...r.kernel.org, David Miller <davem@...emloft.net>,
devicetree@...r.kernel.org,
Florian Fainelli <f.fainelli@...il.com>,
Jacob Keller <jacob.e.keller@...el.com>,
Mark Rutland <mark.rutland@....com>,
Miroslav Lichvar <mlichvar@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH V3 net-next 5/6] net: mdio: of: Register discovered MII
time stampers.
> +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
Powered by blists - more mailing lists