[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52CD3774.3060701@ti.com>
Date: Wed, 8 Jan 2014 17:03:08 +0530
From: Roger Quadros <rogerq@...com>
To: Arnd Bergmann <arnd@...db.de>,
Kishon Vijay Abraham I <kishon@...com>
CC: <tj@...nel.org>, <sergei.shtylyov@...entembedded.com>,
<b.zolnierkie@...sung.com>, <hdegoede@...hat.com>,
<linux-ide@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<devicetree@...r.kernel.org>, Balaji T K <balajitk@...com>
Subject: Re: [PATCH v3 2/3] ata: ahci_platform: Manage SATA PHY
On 01/08/2014 04:58 PM, Roger Quadros wrote:
> On 01/08/2014 03:35 PM, Arnd Bergmann wrote:
>> 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.
>
> OK.
>
>>
>>>> + 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.
>
> OK. How does this look?
>
> hpriv->phy = devm_phy_get(dev, "sata-phy");
> if (IS_ERR(hpriv->phy)) {
> if (PTR_ERR(hpriv->phy) == -ENODEV)
> goto continue;
yikes :P
goto phyinit;
>
> dev_err(dev, "couldn't get sata-phy\n");
> rc = PTR_ERR(hpriv->phy);
> goto disable_unprepare_clk;
> }
>
> continue:
phyinit:
>
> if (!IS_ERR(hpriv->phy)) {
> rc = phy_init(hpriv->phy);
> if (rc)
> goto disable_unprepare_clk;
>
> rc = phy_power_on(hpriv->phy);
> if (rc) {
> phy_exit(hpriv->phy);
> goto disable_unprepare_clk;
> }
> }
>
> cheers,
> -roger
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists