• Arnd Bergmann's avatar
    clk: vt8500: don't return possibly uninitialized data · 7001ec56
    Arnd Bergmann authored
    The clk-vt8500.c driver would previously enter an endless loop
    when invalid settings got requested, this was now fixed. However,
    the driver will now return uninitialized data for a subset of those
    cases instead, as the gcc correctly warns:
    
    clk/clk-vt8500.c: In function 'wm8650_find_pll_bits':
    clk/clk-vt8500.c:423:12: error: 'best_div2' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      *divisor2 = best_div2;
                ^
    clk/clk-vt8500.c:422:12: error: 'best_div1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      *divisor1 = best_div1;
                ^
    clk/clk-vt8500.c:421:14: error: 'best_mul' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      *multiplier = best_mul;
    
    This reworks the error handling in the driver so we now return
    -EINVAL from clk_round_rate() and clk_set_rate() when we get
    impossible inputs.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Fixes: 090341b0 ("clk: vt8500: fix sign of possible PLL values")
    Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
    7001ec56
clk-vt8500.c 18.2 KB