lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5407A82B.7000602@codeaurora.org>
Date:	Wed, 03 Sep 2014 16:45:47 -0700
From:	Stephen Boyd <sboyd@...eaurora.org>
To:	Tomeu Vizoso <tomeu.vizoso@...labora.com>,
	Mike Turquette <mturquette@...aro.org>
CC:	Stephen Warren <swarren@...dotorg.org>,
	Tomasz Figa <t.figa@...sung.com>, linux-kernel@...r.kernel.org,
	Javier Martinez Canillas <javier.martinez@...labora.co.uk>,
	rabin@....in, Thierry Reding <thierry.reding@...il.com>,
	Peter De Schrijver <pdeschrijver@...dia.com>,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v8 4/7] clk: use struct clk only for external API

On 09/01/14 08:34, Tomeu Vizoso wrote:

>
> NOTE: with this patch, clk_get_parent() behaves like clk_get(), i.e. it
> needs to be matched with a clk_put().  Otherwise, memory will leak.
>
[...]
>  }
> +EXPORT_SYMBOL_GPL(clk_provider_get_parent);
> +
> +/**
> + * clk_get_parent - return the parent of a clk
> + * @clk_user: the clk whose parent gets returned
> + *
> + * Simply returns clk->parent.  Returns NULL if clk is NULL.

We should at least document here that clk_put() is expected to be called
when it's not being used. I wonder why it's this way though. Why can't
every clk_core have a private clk pointer to it's parent that's created
during registration time? Then we just hand that out for
clk_get_parent() and destroy it when the clk_core is freed?

> + */
> +struct clk *clk_get_parent(struct clk *clk_user)
> +{
> +	struct clk_core *clk;
> +	struct clk_core *parent;
> +
> +	if (!clk_user)
> +		return NULL;
> +
> +	clk = clk_to_clk_core(clk_user);
> +	parent = clk_provider_get_parent(clk);
> +
> +	return __clk_create_clk(parent);
> +}
>  EXPORT_SYMBOL_GPL(clk_get_parent);
>  

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ