diff mbox

powerpc: 512x: Fix mpc5121_clk_get()

Message ID 1332788489-27435-1-git-send-email-richard@nod.at (mailing list archive)
State Accepted, archived
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Richard Weinberger March 26, 2012, 7:01 p.m. UTC
If try_module_get() fails, mpc5121_clk_get() might return
a wrong clock.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 arch/powerpc/platforms/512x/clock.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Comments

Richard Weinberger April 9, 2012, 1:06 p.m. UTC | #1
Am 26.03.2012 21:01, schrieb Richard Weinberger:
> If try_module_get() fails, mpc5121_clk_get() might return
> a wrong clock.
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
>  arch/powerpc/platforms/512x/clock.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
> index 1d8700f..9f771e0 100644
> --- a/arch/powerpc/platforms/512x/clock.c
> +++ b/arch/powerpc/platforms/512x/clock.c
> @@ -54,14 +54,16 @@ static DEFINE_MUTEX(clocks_mutex);
>  static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
>  {
>  	struct clk *p, *clk = ERR_PTR(-ENOENT);
> -	int dev_match = 0;
> -	int id_match = 0;
> +	int dev_match;
> +	int id_match;
>  
>  	if (dev == NULL || id == NULL)
>  		return clk;
>  
>  	mutex_lock(&clocks_mutex);
>  	list_for_each_entry(p, &clocks, node) {
> +		dev_match = id_match = 0;
> +
>  		if (dev == p->dev)
>  			dev_match++;
>  		if (strcmp(id, p->name) == 0)

*ping*

Thanks,
//richard
Anatolij Gustschin April 11, 2012, 9:06 a.m. UTC | #2
On Mon, 26 Mar 2012 21:01:29 +0200
Richard Weinberger <richard@nod.at> wrote:

> If try_module_get() fails, mpc5121_clk_get() might return
> a wrong clock.
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
>  arch/powerpc/platforms/512x/clock.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)

Applied, thanks.

Anatolij
diff mbox

Patch

diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index 1d8700f..9f771e0 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -54,14 +54,16 @@  static DEFINE_MUTEX(clocks_mutex);
 static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
 {
 	struct clk *p, *clk = ERR_PTR(-ENOENT);
-	int dev_match = 0;
-	int id_match = 0;
+	int dev_match;
+	int id_match;
 
 	if (dev == NULL || id == NULL)
 		return clk;
 
 	mutex_lock(&clocks_mutex);
 	list_for_each_entry(p, &clocks, node) {
+		dev_match = id_match = 0;
+
 		if (dev == p->dev)
 			dev_match++;
 		if (strcmp(id, p->name) == 0)