From: Giuseppe CAVALLARO <peppe.cavallaro@st•com>
To: David Miller <davem@davemloft•net>
Cc: <netdev@vger•kernel.org>
Subject: Re: [PATCH (net.git)] stmmac: ptp: fix the reference clock
Date: Thu, 28 Aug 2014 08:02:10 +0200 [thread overview]
Message-ID: <53FEC5E2.9020708@st.com> (raw)
In-Reply-To: <20140827.162652.544817209778584023.davem@davemloft.net>
Hi David
On 8/28/2014 1:26 AM, David Miller wrote:
> From: Giuseppe Cavallaro <peppe.cavallaro@st•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.
>
prev parent reply other threads:[~2014-08-28 6:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 6:04 [PATCH (net.git)] stmmac: ptp: fix the reference clock Giuseppe Cavallaro
2014-08-27 8:37 ` [PATCH (net.git) (v2)] " Giuseppe Cavallaro
2014-08-30 2:55 ` David Miller
2014-08-27 23:26 ` [PATCH (net.git)] " David Miller
2014-08-28 6:02 ` Giuseppe CAVALLARO [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=53FEC5E2.9020708@st.com \
--to=peppe.cavallaro@st$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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