]> git.baikalelectronics.ru Git - kernel.git/commit
clk: fix parent validation in __clk_set_parent()
authorRajendra Nayak <rnayak@ti.com>
Tue, 3 Jul 2012 06:41:41 +0000 (12:11 +0530)
committerMike Turquette <mturquette@linaro.org>
Tue, 3 Jul 2012 19:05:14 +0000 (12:05 -0700)
commit9b6d475bbacc151aa83abf08539440f0418f23b5
tree990c7445eff9b8da1e52eeca07101c13d928c920
parent3b15e0f7495f5dcfda3ad9d09b0aa6894191804f
clk: fix parent validation in __clk_set_parent()

The below commit introduced a bug in __clk_set_parent()
which could cause it to *skip* the parent validation
which makes sure the parent passed to the api is a valid
one.

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

        clk: Allow late cache allocation for clk->parents

This was identified by the following compiler 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]

.. as reported by Marc Kleine-Budde.

There were various options discussed on how to fix this, one
being initing 'i' to clk->num_parents, but the below approach
was found to be more appropriate as it also makes the 'parent
validation' code simpler to read.

Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Cc: stable@kernel.org
drivers/clk/clk.c