linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Aaron Kling <webgeek1234@gmail.com>
Cc: linux-tegra@vger.kernel.org
Subject: [bug report] cpufreq: tegra186: add OPP support and set bandwidth
Date: Fri, 24 Oct 2025 09:19:42 +0300	[thread overview]
Message-ID: <aPsafpMKVTxj20zL@stanley.mountain> (raw)

Hello Aaron Kling,

Commit 71c46a6457e0 ("cpufreq: tegra186: add OPP support and set
bandwidth") from Oct 21, 2025 (linux-next), leads to the following
Smatch static checker warning:

	drivers/cpufreq/tegra186-cpufreq.c:197 tegra186_cpufreq_init()
	error: uninitialized symbol 'freq_table'.

drivers/cpufreq/tegra186-cpufreq.c
    174 static int tegra186_cpufreq_init(struct cpufreq_policy *policy)
    175 {
    176         struct tegra186_cpufreq_data *data = cpufreq_get_driver_data();
    177         unsigned int cluster = data->cpus[policy->cpu].bpmp_cluster_id;
    178         struct cpufreq_frequency_table *freq_table;
    179         struct cpufreq_frequency_table *bpmp_lut;
    180         u32 cpu;
    181         int ret;
    182 
    183         policy->cpuinfo.transition_latency = 300 * 1000;
    184         policy->driver_data = NULL;
    185 
    186         /* set same policy for all cpus in a cluster */
    187         for (cpu = 0; cpu < ARRAY_SIZE(tegra186_cpus); cpu++) {
    188                 if (data->cpus[cpu].bpmp_cluster_id == cluster)
    189                         cpumask_set_cpu(cpu, policy->cpus);
    190         }
    191 
    192         bpmp_lut = data->clusters[cluster].bpmp_lut;
    193 
    194         if (data->icc_dram_bw_scaling) {
    195                 ret = tegra_cpufreq_init_cpufreq_table(policy, bpmp_lut, &freq_table);
    196                 if (!ret) {
--> 197                         policy->freq_table = freq_table;

tegra_cpufreq_init_cpufreq_table() will return zero if there are no
available opps.  The freq_table will be uninitialized in that case.
It's this path:

          122          max_opps = dev_pm_opp_get_opp_count(cpu_dev);
          123          if (max_opps <= 0) {
          124                  dev_err(cpu_dev, "Failed to add OPPs\n");
          125                  return max_opps;
          126          }

    198                         return 0;
    199                 }
    200         }
    201 
    202         data->icc_dram_bw_scaling = false;
    203         policy->freq_table = bpmp_lut;
    204         pr_info("OPP tables missing from DT, EMC frequency scaling disabled\n");
    205 
    206         return 0;
    207 }

regards,
dan carpenter

             reply	other threads:[~2025-10-24  6:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24  6:19 Dan Carpenter [this message]
2025-10-24  8:00 ` [bug report] cpufreq: tegra186: add OPP support and set bandwidth Aaron Kling
2025-10-27  8:44   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aPsafpMKVTxj20zL@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=webgeek1234@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).