All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre Gondois <pierre.gondois@arm.com>
To: Dan Carpenter <error27@gmail.com>
Cc: linux-acpi@vger.kernel.org
Subject: Re: [bug report] arch_topology: Build cacheinfo from primary CPU
Date: Mon, 23 Jan 2023 16:14:56 +0100	[thread overview]
Message-ID: <6fc14182-520b-d3ee-410c-8be3bc98a514@arm.com> (raw)
In-Reply-To: <Y86iruJPuwNN7rZw@kili>

Hello Dan,
The 'levels' and 'split_levels' variables are initialized through their
addresses when necessary, so I believe the warning can be ignored.

If you still want to have the variables initialized, please let me know and I
will send a patch,

Regards,
Pierre

On 1/23/23 16:07, Dan Carpenter wrote:
> Hello Pierre Gondois,
> 
> The patch 5944ce092b97: "arch_topology: Build cacheinfo from primary
> CPU" from Jan 4, 2023, leads to the following Smatch static checker
> warning:
> 
> drivers/base/cacheinfo.c:440 fetch_cache_info()	error: uninitialized symbol 'levels'.
> drivers/base/cacheinfo.c:447 fetch_cache_info() error: uninitialized symbol 'split_levels'.
> 
> drivers/base/cacheinfo.c
>      424 int fetch_cache_info(unsigned int cpu)
>      425 {
>      426         struct cpu_cacheinfo *this_cpu_ci;
>      427         unsigned int levels, split_levels;
>      428         int ret;
>      429
>      430         if (acpi_disabled) {
>      431                 ret = init_of_cache_level(cpu);
>      432                 if (ret < 0)
>      433                         return ret;
>      434         } else {
>      435                 ret = acpi_get_cache_info(cpu, &levels, &split_levels);
>      436                 if (ret < 0)
>      437                         return ret;
> 
> Apparently, I must have CONFIG_ACPI_PPTT disabled.
> 
>      438
>      439                 this_cpu_ci = get_cpu_cacheinfo(cpu);
> --> 440                 this_cpu_ci->num_levels = levels;
>                                                    ^^^^^^
> Unititialized.
> 
>      441                 /*
>      442                  * This assumes that:
>      443                  * - there cannot be any split caches (data/instruction)
>      444                  *   above a unified cache
>      445                  * - data/instruction caches come by pair
>      446                  */
>      447                 this_cpu_ci->num_leaves = levels + split_levels;
>      448         }
>      449         if (!cache_leaves(cpu))
>      450                 return -ENOENT;
>      451
>      452         return allocate_cache_info(cpu);
>      453 }
> 
> regards,
> dan carpenter

  reply	other threads:[~2023-01-23 15:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 15:07 [bug report] arch_topology: Build cacheinfo from primary CPU Dan Carpenter
2023-01-23 15:14 ` Pierre Gondois [this message]
2023-01-23 15:44   ` Dan Carpenter
2023-01-23 16:20     ` Pierre Gondois

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=6fc14182-520b-d3ee-410c-8be3bc98a514@arm.com \
    --to=pierre.gondois@arm.com \
    --cc=error27@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.