lib/percpu_counter: add missing __percpu qualifier to a cast
authorUros Bizjak <ubizjak@gmail.com>
Wed, 14 Aug 2024 06:44:13 +0000 (08:44 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 2 Sep 2024 03:43:34 +0000 (20:43 -0700)
Add missing __percpu qualifier to a (void *) cast to fix

percpu_counter.c:212:36: warning: cast removes address space '__percpu' of expression
percpu_counter.c:212:33: warning: incorrect type in assignment (different address spaces)
percpu_counter.c:212:33:    expected signed int [noderef] [usertype] __percpu *counters
percpu_counter.c:212:33:    got void *

sparse warnings.

Found by GCC's named address space checks.

There were no changes in the resulting object file.

Link: https://lkml.kernel.org/r/20240814064437.940162-1-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/percpu_counter.c

index 51bc5246986d089bcbafac7e4fe4184c4e16dcea..2891f94a11c654958fb52f8d965d06b62719500c 100644 (file)
@@ -209,7 +209,7 @@ int __percpu_counter_init_many(struct percpu_counter *fbc, s64 amount,
                INIT_LIST_HEAD(&fbc[i].list);
 #endif
                fbc[i].count = amount;
-               fbc[i].counters = (void *)counters + (i * counter_size);
+               fbc[i].counters = (void __percpu *)counters + i * counter_size;
 
                debug_percpu_counter_activate(&fbc[i]);
        }