]> git.karo-electronics.de Git - linux-beck.git/blobdiff - drivers/cpufreq/cpufreq-dt.c
cpufreq: cpufreq-dt: avoid uninitialized variable warnings:
[linux-beck.git] / drivers / cpufreq / cpufreq-dt.c
index 1ceece9d67112217c95dfa820ebf38a7f6495ef2..0ca74d07005830cec5abaf92a84c59af17325616 100644 (file)
@@ -50,7 +50,8 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index)
        struct private_data *priv = policy->driver_data;
        struct device *cpu_dev = priv->cpu_dev;
        struct regulator *cpu_reg = priv->cpu_reg;
-       unsigned long volt = 0, volt_old = 0, tol = 0;
+       unsigned long volt = 0, tol = 0;
+       int volt_old = 0;
        unsigned int old_freq, new_freq;
        long freq_Hz, freq_exact;
        int ret;
@@ -83,7 +84,7 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index)
                        opp_freq / 1000, volt);
        }
 
-       dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n",
+       dev_dbg(cpu_dev, "%u MHz, %d mV --> %u MHz, %ld mV\n",
                old_freq / 1000, (volt_old > 0) ? volt_old / 1000 : -1,
                new_freq / 1000, volt ? volt / 1000 : -1);
 
@@ -141,15 +142,16 @@ static int allocate_resources(int cpu, struct device **cdev,
 
 try_again:
        cpu_reg = regulator_get_optional(cpu_dev, reg);
-       if (IS_ERR(cpu_reg)) {
+       ret = PTR_ERR_OR_ZERO(cpu_reg);
+       if (ret) {
                /*
                 * If cpu's regulator supply node is present, but regulator is
                 * not yet registered, we should try defering probe.
                 */
-               if (PTR_ERR(cpu_reg) == -EPROBE_DEFER) {
+               if (ret == -EPROBE_DEFER) {
                        dev_dbg(cpu_dev, "cpu%d regulator not ready, retry\n",
                                cpu);
-                       return -EPROBE_DEFER;
+                       return ret;
                }
 
                /* Try with "cpu-supply" */
@@ -158,18 +160,16 @@ try_again:
                        goto try_again;
                }
 
-               dev_dbg(cpu_dev, "no regulator for cpu%d: %ld\n",
-                       cpu, PTR_ERR(cpu_reg));
+               dev_dbg(cpu_dev, "no regulator for cpu%d: %d\n", cpu, ret);
        }
 
        cpu_clk = clk_get(cpu_dev, NULL);
-       if (IS_ERR(cpu_clk)) {
+       ret = PTR_ERR_OR_ZERO(cpu_clk);
+       if (ret) {
                /* put regulator */
                if (!IS_ERR(cpu_reg))
                        regulator_put(cpu_reg);
 
-               ret = PTR_ERR(cpu_clk);
-
                /*
                 * If cpu's clk node is present, but clock is not yet
                 * registered, we should try defering probe.