Re: [PATCH v5 14/20] watchdog: orion: Add support for Armada 370 and Armada XP SoC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, Jan 27, 2014 at 05:36:24PM +0000, Russell King - ARM Linux wrote:
[..]
> > +static int armadaxp_wdt_clock_init(struct platform_device *pdev,
> > +				   struct orion_watchdog *dev)
> > +{
> > +	int ret;
> > +
> > +	dev->clk = of_clk_get_by_name(pdev->dev.of_node, "fixed");
> > +	if (IS_ERR(dev->clk))
> > +		return PTR_ERR(dev->clk);
> > +	ret = clk_prepare_enable(dev->clk);
> > +	if (ret)
> > +		return ret;
> > +
> > +	/* Enable the fixed watchdog clock input */
> > +	atomic_io_modify(dev->reg + TIMER_CTRL,
> > +			 WDT_AXP_FIXED_ENABLE_BIT,
> > +			 WDT_AXP_FIXED_ENABLE_BIT);
> > +
> > +	dev->clk_rate = clk_get_rate(dev->clk);
> > +	return 0;
> > +}
> 
> Doesn't this result in dev->clk being leaked?  Or at least a difference
> in the way dev->clk needs to be cleaned up between these two functions?
> 

Yes, indeed.

> I think it would be better in this case to use the standard clk_get() in
> the first function and always use clk_put()... until there is a devm_*
> version of the of_clk_get* functions.
> 

Sound good.

Thanks,
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux