devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Tero Kristo <t-kristo@ti.com>,
	linux-omap@vger.kernel.org, paul@pwsan.com, tony@atomide.com,
	mturquette@linaro.org
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 05/12] CLK: TI: APLL: add support for omap2 aplls
Date: Fri, 28 Feb 2014 13:14:59 -0600	[thread overview]
Message-ID: <5310E033.3000900@ti.com> (raw)
In-Reply-To: <1393579384-23440-6-git-send-email-t-kristo@ti.com>

On 02/28/2014 03:22 AM, Tero Kristo wrote:
[...]
> +static void __init of_omap2_apll_setup(struct device_node *node)
> +{
> +	struct dpll_data *ad = NULL;
> +	struct clk_hw_omap *clk_hw = NULL;
> +	struct clk_init_data *init = NULL;
> +	struct clk *clk;
> +	const char *parent_name;
> +	u32 val;
> +
> +	ad = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
> +	clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
> +	init = kzalloc(sizeof(*init), GFP_KERNEL);
> +
> +	if (!ad || !clk_hw || !init)
> +		goto cleanup;
> +
> +	clk_hw->dpll_data = ad;
> +	clk_hw->hw.init = init;
> +	init->ops = &omap2_apll_ops;
> +	init->name = node->name;
> +	clk_hw->ops = &omap2_apll_hwops;
> +
> +	init->num_parents = of_clk_get_parent_count(node);
> +	if (init->num_parents != 1) {
> +		pr_err("%s must have one parent\n", node->name);
> +		goto cleanup;
> +	}
> +
> +	parent_name = of_clk_get_parent_name(node, 0);
> +	init->parent_names = &parent_name;
> +
> +	if (of_property_read_u32(node, "ti,clock-frequency", &val)) {
> +		pr_err("%s missing clock-frequency\n", node->name);
> +		goto cleanup;
> +	}
> +	clk_hw->fixed_rate = val;
> +
> +	if (of_property_read_u32(node, "ti,bit-shift", &val)) {
> +		pr_err("%s missing bit-shift\n", node->name);
> +		goto cleanup;
> +	}
> +
> +	clk_hw->enable_bit = val;
> +	ad->enable_mask = 0x3 << val;
> +	ad->autoidle_mask = 0x3 << val;
> +
> +	if (of_property_read_u32(node, "ti,idlest-shift", &val)) {
> +		pr_err("%s missing idlest-shift\n", node->name);
> +		goto cleanup;
> +	}
> +
> +	ad->idlest_mask = 1 << val;
> +
> +	ad->control_reg = ti_clk_get_reg_addr(node, 0);
> +	ad->autoidle_reg = ti_clk_get_reg_addr(node, 1);
> +	ad->idlest_reg = ti_clk_get_reg_addr(node, 2);
> +
> +	if (!ad->control_reg || !ad->autoidle_reg || !ad->idlest_reg)
> +		goto cleanup;
> +
> +	clk = clk_register(NULL, &clk_hw->hw);
> +	if (!IS_ERR(clk)) {
> +		of_clk_add_provider(node, of_clk_src_simple_get, clk);
> +		kfree(init);
> +		return;
> +	}
> +cleanup:
> +	kfree(clk_hw);
> +	kfree(init);
kfree(ad)?

smatch reported (as part of the kernel_patch_verify_report:
+drivers/clk/ti/apll.c:400 of_omap2_apll_setup() warn: possible memory
leak of 'ad'

-- 
Regards,
Nishanth Menon

  reply	other threads:[~2014-02-28 19:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28  9:22 [PATCH 00/12] ARM: OMAP2 DT clock conversion Tero Kristo
2014-02-28  9:22 ` [PATCH 01/12] ARM: OMAP2: convert sys_ck and osc_ck to standard clock types Tero Kristo
2014-02-28  9:22 ` [PATCH 03/12] CLK: TI: DPLL: simplify autoidle register detection logic Tero Kristo
2014-02-28  9:22 ` [PATCH 04/12] CLK: TI: DPLL: add support for omap2 core dpll Tero Kristo
     [not found] ` <1393579384-23440-1-git-send-email-t-kristo-l0cyMroinI0@public.gmane.org>
2014-02-28  9:22   ` [PATCH 02/12] ARM: OMAP2420: clock: get rid of fixed-div property use Tero Kristo
2014-02-28  9:22   ` [PATCH 05/12] CLK: TI: APLL: add support for omap2 aplls Tero Kristo
2014-02-28 19:14     ` Nishanth Menon [this message]
2014-02-28  9:22 ` [PATCH 06/12] CLK: TI: gate: fixed DT binding documentation bugs Tero Kristo
2014-02-28  9:22 ` [PATCH 07/12] CLK: TI: interface: add support for omap2430 specific interface clock Tero Kristo
2014-02-28  9:23 ` [PATCH 08/12] CLK: TI: OMAP2: add clock init support Tero Kristo
2014-02-28  9:23 ` [PATCH 09/12] ARM: dts: omap2 clock data Tero Kristo
2014-02-28  9:23 ` [PATCH 10/12] ARM: OMAP2: clock: add DT boot support for cpufreq_ck Tero Kristo
2014-02-28  9:23 ` [PATCH 11/12] ARM: OMAP2: PRM: add support for OMAP2 specific clock providers Tero Kristo
2014-02-28 19:17   ` Nishanth Menon
2014-02-28  9:23 ` [PATCH 12/12] ARM: OMAP2: clock: use DT clock boot if available Tero Kristo
2014-02-28 15:59 ` [PATCH 00/12] ARM: OMAP2 DT clock conversion Nishanth Menon
2014-02-28 18:01   ` Tony Lindgren
2014-02-28 18:18     ` Tero Kristo
2014-02-28 18:33       ` Tony Lindgren
2014-03-03  8:16         ` Tero Kristo
2014-03-03 18:46           ` Tony Lindgren
2014-03-03 18:51             ` Tero Kristo

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=5310E033.3000900@ti.com \
    --to=nm@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=paul@pwsan.com \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.com \
    /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).