Re: [PATCH v2 0/2] cpupower: fix topology array handling
From: Shuah Khan
Date: Thu Aug 06 2026 - 11:50:21 EST
On 8/5/26 05:43, Ali Ahmet Memis wrote:
On Tue, 4 Aug 2026 14:45:48 -0600 Shuah Khan wrote:
Did you think about a scenario when the following check will be tru - i.e
core == -1 is trur?
I went looking for one and could not find it, so that branch may well be
dead. What I checked:
That is really the questions - the branch isn't dead, it is in the wrong
place.
Sounds like you don't have a real scenario to test this change. This why
I am not eager to take either of these patches.
However, did you consider simplifying the logic in these conditionals?
if(sysfs_topology_read_file(
cpu,
"physical_package_id",
&(cpu_top->core_info[cpu].pkg)) < 0) {
cpu_top->core_info[cpu].pkg = -1;
cpu_top->core_info[cpu].core = -1;
continue;
-- Is this continue necessary here?
}
if(sysfs_topology_read_file(
cpu,
"core_id",
&(cpu_top->core_info[cpu].core)) < 0) {
cpu_top->core_info[cpu].pkg = -1;
cpu_top->core_info[cpu].core = -1;
continue;
-- Is this continue necessary here?
}
I think the following logic makes sense without the continue(s)
if (cpu_top->core_info[cpu].core == -1) {
strncpy(cpu_top->core_info[cpu].core_cpu_list, "-1", CPULIST_BUFFER);
continue;
}
thanks,
-- Shuah