• Arnd Bergmann's avatar
    cpufreq: cpufreq-dt: avoid uninitialized variable warnings: · b331bc20
    Arnd Bergmann authored
    gcc warns quite a bit about values returned from allocate_resources()
    in cpufreq-dt.c:
    
    cpufreq-dt.c: In function 'cpufreq_init':
    cpufreq-dt.c:327:6: error: 'cpu_dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    cpufreq-dt.c:197:17: note: 'cpu_dev' was declared here
    cpufreq-dt.c:376:2: error: 'cpu_clk' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    cpufreq-dt.c:199:14: note: 'cpu_clk' was declared here
    cpufreq-dt.c: In function 'dt_cpufreq_probe':
    cpufreq-dt.c:461:2: error: 'cpu_clk' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    cpufreq-dt.c:447:14: note: 'cpu_clk' was declared here
    
    The problem is that it's slightly hard for gcc to follow return
    codes across PTR_ERR() calls.
    
    This patch uses explicit assignments to the "ret" variable to make
    it easier for gcc to verify that the code is actually correct,
    without the need to add a bogus initialization.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    b331bc20
cpufreq-dt.c 12.2 KB