Re: [PATCH v3 2/3] ata: ahci_platform: Manage SATA PHY

From: Arnd Bergmann
Date: Wed Jan 08 2014 - 05:05:48 EST


On Wednesday 08 January 2014 15:29:18 Kishon Vijay Abraham I wrote:
> > + hpriv->phy = devm_phy_get(dev, "sata-phy");
> > + if (IS_ERR(hpriv->phy)) {
> > + dev_dbg(dev, "can't get sata-phy\n");
> > + /* return only if -EPROBE_DEFER */
> > + if (PTR_ERR(hpriv->phy) == -EPROBE_DEFER) {
> > + rc = -EPROBE_DEFER;
> > + goto disable_unprepare_clk;
> > + }
> > + }

This should probably check for all errors except "not present"
rather than checking for -EPROBE_DEFER. We want to abort the
probe function for deferred probe as well as the case where we
a PHY was listed but isn't working properly.

> > + if (!IS_ERR(hpriv->phy)) {
> > + phy_init(hpriv->phy);
>
> Don't we have to check the return values of phy_init and phy_power_on? Is it
> not needed because it is an optional phy?

Right. I think we should set hpriv->phy to NULL if it's not there and
then call the functions only if it's actually present but bail out on
an error.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/