[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53FEC5E2.9020708@st.com>
Date: Thu, 28 Aug 2014 08:02:10 +0200
From: Giuseppe CAVALLARO <peppe.cavallaro@...com>
To: David Miller <davem@...emloft.net>
Cc: <netdev@...r.kernel.org>
Subject: Re: [PATCH (net.git)] stmmac: ptp: fix the reference clock
Hi David
On 8/28/2014 1:26 AM, David Miller wrote:
> From: Giuseppe Cavallaro <peppe.cavallaro@...com>
> Date: Tue, 26 Aug 2014 08:04:32 +0200
>
>> @@ -638,6 +638,15 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
>> if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp))
>> return -EOPNOTSUPP;
>>
>> + /* Fall-back to main clock in case of no PTP ref is passed */
>> + priv->clk_ptp_ref = devm_clk_get(priv->device, "clk_ptp_ref");
>> + if (IS_ERR(priv->clk_ptp_ref)) {
>> + priv->clk_ptp_rate = clk_get_rate(priv->stmmac_clk);
>
> This code path will leave an IS_ERR() value in clk_ptp_ref.
> ...
>> static void stmmac_release_ptp(struct stmmac_priv *priv)
>> {
>> + if (priv->clk_ptp_ref)
>> + clk_disable_unprepare(priv->clk_ptp_ref);
>> stmmac_ptp_unregister(priv);
>> }
>
> Which this code will erroneously pass into clk_disable_unprepare().
>
> Please NULL the pointer out properl when devm_clk_get() errors.
I had sent the v2, let me know if it's ok for you.
peppe
>
> Thanks.
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists