From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: ansuelsmth@gmail.com
Cc: 'Andy Gross' <agross@kernel.org>,
'Bjorn Andersson' <bjorn.andersson@linaro.org>,
"'David S. Miller'" <davem@davemloft.net>,
'Rob Herring' <robh+dt@kernel.org>,
'Mark Rutland' <mark.rutland@arm.com>,
'Andrew Lunn' <andrew@lunn.ch>,
'Florian Fainelli' <f.fainelli@gmail.com>,
'Heiner Kallweit' <hkallweit1@gmail.com>,
linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: R: [PATCH v3 1/2] net: mdio: add ipq8064 mdio driver
Date: Fri, 21 Feb 2020 11:52:48 +0000 [thread overview]
Message-ID: <20200221115248.GH25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <000601d5e850$c0161cc0$40425640$@gmail.com>
On Fri, Feb 21, 2020 at 01:49:17AM +0100, ansuelsmth@gmail.com wrote:
> > On Fri, Feb 21, 2020 at 12:26:21AM +0100, Ansuel Smith wrote:
> > > +static int
> > > +ipq8064_mdio_probe(struct platform_device *pdev)
> > > +{
> > > + struct device_node *np = pdev->dev.of_node;
> > > + struct ipq8064_mdio *priv;
> > > + struct mii_bus *bus;
> > > + int ret;
> > > +
> > > + bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv));
> > > + if (!bus)
> > > + return -ENOMEM;
> > > +
> > > + bus->name = "ipq8064_mdio_bus";
> > > + bus->read = ipq8064_mdio_read;
> > > + bus->write = ipq8064_mdio_write;
> > > + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev-
> > >dev));
> > > + bus->parent = &pdev->dev;
> > > +
> > > + priv = bus->priv;
> > > + priv->base = syscon_node_to_regmap(np);
> > > + if (IS_ERR_OR_NULL(priv->base)) {
> > > + priv->base = syscon_regmap_lookup_by_phandle(np,
> > "master");
> > > + if (IS_ERR_OR_NULL(priv->base)) {
> > > + dev_err(&pdev->dev, "master phandle not
> > found\n");
> > > + return -EINVAL;
> > > + }
> > > + }
> >
> > I'm curious why you've kept this as-is given my comments?
> >
> > If you don't agree with them, it would be helpful to reply to the
> > review email giving the reasons why.
>
> I read your command and now I understand what you mean. Since they both
> never return NULL the IS_ERR_OR_NULL is wrong and only IS_ERR should be
> used. Correct me if I'm wrong.
> About the error propagation, should I return the
> syscon_regmap_lookup_by_phandle
> error or I can keep the EINVAL error?
Hi,
You probably want something like:
priv->base = syscon_node_to_regmap(np);
if (IS_ERR(priv->base) && priv->base != ERR_PTR(-EPROBE_DEFER))
priv->base = syscon_regmap_lookup_by_phandle(np, "master");
if (priv->base == ERR_PTR(-EPROBE_DEFER)) {
return -EPROBE_DEFER;
} else if (IS_ERR(priv->base)) {
dev_err(&pdev->dev, "error getting syscon regmap, error=%pe\n",
priv->base);
return PTR_ERR(priv->base);
}
Please ensure that you test the above, including the case where you
should fall through to syscon_regmap_lookup_by_phandle().
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
prev parent reply other threads:[~2020-02-21 11:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 23:26 [PATCH v3 1/2] net: mdio: add ipq8064 mdio driver Ansuel Smith
2020-02-20 23:26 ` [PATCH v3 2/2] Documentation: devictree: Add ipq806x mdio bindings Ansuel Smith
2020-02-21 15:23 ` Rob Herring
2020-02-21 0:40 ` [PATCH v3 1/2] net: mdio: add ipq8064 mdio driver Russell King - ARM Linux admin
2020-02-21 0:49 ` R: " ansuelsmth
2020-02-21 11:52 ` Russell King - ARM Linux admin [this message]
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=20200221115248.GH25745@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=agross@kernel.org \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=bjorn.andersson@linaro.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@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).