linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] clk: __clk_set_parent: set uninitialized variable
@ 2012-07-02  7:41 Marc Kleine-Budde
  2012-07-02  8:42 ` Rajendra Nayak
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-07-02  7:41 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes the following warning:

    drivers/clk/clk.c: In function '__clk_set_parent':
    drivers/clk/clk.c:1083:5: warning: 'i' may be used uninitialized in this function [-Wuninitialized]

which has been introduced with commit:

    commit 7975059db572eb47f0fb272a62afeae272a4b209
    Author: Rajendra Nayak <rnayak@ti.com>
    Date:   Wed Jun 6 14:41:31 2012 +0530

        clk: Allow late cache allocation for clk->parents

This patch applies to linux-3.5-rc5

Cc: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Hello,

here an updated version. Changes since v1:
- Set i to clk->num_parents as Uwe pointed out.

regards, Marc

 drivers/clk/clk.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index dcbe056..9a75635 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1068,13 +1068,15 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent)
 	old_parent = clk->parent;
 
 	/* find index of new parent clock using cached parent ptrs */
-	if (clk->parents)
+	if (clk->parents) {
 		for (i = 0; i < clk->num_parents; i++)
 			if (clk->parents[i] == parent)
 				break;
-	else
+	} else {
+		i = clk->num_parents
 		clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents),
 								GFP_KERNEL);
+	}
 
 	/*
 	 * find index of new parent clock using string name comparison
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-03 23:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02  7:41 [PATCH v2] clk: __clk_set_parent: set uninitialized variable Marc Kleine-Budde
2012-07-02  8:42 ` Rajendra Nayak
2012-07-02  8:45   ` Rajendra Nayak
2012-07-02 23:29   ` Turquette, Mike
2012-07-03 10:29     ` Rajendra Nayak
2012-07-03 10:50     ` Uwe Kleine-König
2012-07-03 23:30       ` Mike Turquette

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