The variable 'index' is declared as unsigned but used to receive the
return value of a function returning 'int'. This value is then tested
for being less than zero to detect an error condition but as index is
unsigned this can never be true. Change the variable 'index' to be an
int so that the error condition can be detected.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
{
struct clk_main *main = to_clk_main(clk);
void __iomem *reg = main->reg;
- unsigned int tmp, index;
+ unsigned int tmp;
+ int index;
index = at91_clk_mux_val_to_index(main->clk_mux_table,
main->num_parents, AT91_CLK_ID_TO_DID(parent->id));
{
struct clk_master *master;
struct clk *clk;
- u32 val, index;
- int ret;
+ u32 val;
+ int ret, index;
if (!base || !name || !num_parents || !parent_names ||
!mux_table || !clk_mux_table || id > MASTER_MAX_ID)