[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140425142049.GR26756@n2100.arm.linux.org.uk>
Date: Fri, 25 Apr 2014 15:20:49 +0100
From: Russell King - ARM Linux <linux@....linux.org.uk>
To: Gregory CLEMENT <gregory.clement@...e-electrons.com>
Cc: Mathias Nyman <mathias.nyman@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Felipe Balbi <balbi@...com>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, Jason Cooper <jason@...edaemon.net>,
Andrew Lunn <andrew@...n.ch>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
Lior Amsalem <alior@...vell.com>,
Tawfik Bayouk <tawfik@...vell.com>, devicetree@...r.kernel.org,
Nadav Haklai <nadavh@...vell.com>,
Rob Herring <robh+dt@...nel.org>,
Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>,
Grant Likely <grant.likely@...aro.org>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 02/18] usb: host: xhci-plat: Add clocks support
On Fri, Apr 25, 2014 at 04:07:00PM +0200, Gregory CLEMENT wrote:
> +#if defined(CONFIG_HAVE_CLK)
> +static int try_enable_clk(struct platform_device *pdev)
> +{
> + struct clk *clk = devm_clk_get(&pdev->dev, NULL);
> +
> + /* Not all platforms have a clk so it is not an error if the clock
> + does not exists. */
> + if (!IS_ERR(clk))
> + if (clk_prepare_enable(clk))
> + return -ENODEV;
> + return 0;
> +}
> +
> +static int try_disable_clk(struct platform_device *pdev)
> +{
> + struct clk *clk = devm_clk_get(&pdev->dev, NULL);
> +
> + /* Not all platforms have a clk so it is not an error if the clock
> + does not exists. */
> + if (!IS_ERR(clk))
> + clk_disable_unprepare(clk);
> +
> + return 0;
> +}
OMG.
You do realise that clk_get() ref-counts against the module which
provided the clock, so this is akin to an explicit leaking module
ref-counts.
--
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
--
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