devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: atull <atull@opensource.altera.com>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Moritz Fischer <moritz.fischer@ettus.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Devicetree List <devicetree@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Dinh Nguyen <dinguyen@opensource.altera.com>,
	Alan Tull <delicious.quinoa@gmail.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 2/2] fpga-manager: Add Socfpga Arria10 support
Date: Wed, 13 Jul 2016 09:47:03 -0500	[thread overview]
Message-ID: <alpine.DEB.2.02.1607130944410.10735@linuxheads99> (raw)
In-Reply-To: <20160712222029.GW1041@n2100.armlinux.org.uk>

On Tue, 12 Jul 2016, Russell King - ARM Linux wrote:

> On Tue, Jul 12, 2016 at 02:31:05PM -0700, Moritz Fischer wrote:
> > On Tue, Jul 12, 2016 at 12:07 PM, Alan Tull <atull@opensource.altera.com> wrote:
> > > +       priv->clk = devm_clk_get(dev, NULL);
> > > +       if (IS_ERR(priv->clk)) {
> > > +               dev_err(dev, "no clock specified\n");
> > > +               return PTR_ERR(priv->clk);
> > > +       }
> > > +
> > > +       ret = clk_prepare_enable(priv->clk);
> > > +       if (ret) {
> > > +               dev_err(dev, "could not enable clock\n");
> > > +               clk_put(priv->clk);
> > 
> > Seen that you used devm_clk_get() is this one necessary?
> 
> That's actually a bug.

Yes, it's wrong.  And not needed anyway.

>  Never clk_put() a devm_clk_get()'d clock.
> devm_clk_put() is what you want if provided.  However, I think
> this clk_put() call is useless here.
> 
> > > +static int socfpga_a10_fpga_remove(struct platform_device *pdev)
> > > +{
> > > +       struct fpga_manager *mgr = platform_get_drvdata(pdev);
> > > +       struct a10_fpga_priv *priv = mgr->priv;
> > > +
> > > +       fpga_mgr_unregister(&pdev->dev);
> > > +       clk_disable_unprepare(priv->clk);
> > > +       clk_put(priv->clk);
> > 
> > Same here, if needed at all shouldn't it be devm_clk_put() ?
> 
> And also useless here, as the whole point of the devm_* stuff is to
> clean up the resources that were claimed on probe failure or when
> the device is unbound from its driver.

Thanks for pointing this out.  I'll take out the clk_put's.

Alan

> 
> -- 
> RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
> FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
> according to speedtest.net.
> 

  reply	other threads:[~2016-07-13 14:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 19:07 [PATCH 0/2] FPGA Manager support for Arria10 Alan Tull
2016-07-12 19:07 ` [PATCH 1/2] ARM: socfpga: add bindings doc for arria10 fpga manager Alan Tull
2016-07-16 22:06   ` Rob Herring
2016-07-19  2:39     ` atull
     [not found]   ` <20160712190709.5964-2-atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2016-07-17 20:40     ` Moritz Fischer
     [not found]       ` <CAAtXAHdFKOoYa0tWrO8=COZXAFN5rNM2-w6sR3H9cMCpT5uqxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-19 13:45         ` atull
2016-07-12 19:07 ` [PATCH 2/2] fpga-manager: Add Socfpga Arria10 support Alan Tull
2016-07-12 21:31   ` Moritz Fischer
2016-07-12 22:20     ` Russell King - ARM Linux
2016-07-13 14:47       ` atull [this message]
2016-07-13 14:58     ` atull

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=alpine.DEB.2.02.1607130944410.10735@linuxheads99 \
    --to=atull@opensource.altera.com \
    --cc=delicious.quinoa@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@opensource.altera.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=moritz.fischer@ettus.com \
    --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).