[PATCH 05/10] sched/debug: Use unsigned long for cpu variable to prevent cast errors

From: Joel Fernandes (Google)
Date: Fri Feb 16 2024 - 13:32:58 EST


This avoids compiler errors seen with clang:

In file included from kernel/sched/build_utility.c:72:
kernel/sched/debug.c:532:47: error: cast to 'void *' from smaller integer
type 'unsigned int' [-Werror,-Wint-to-void-pointer-cast]
debugfs_create_file("runtime", 0644, d_cpu, (void *) cpu, &fair_server_runtime_fops);

Signed-off-by: Joel Fernandes (Google) <joel@xxxxxxxxxxxxxxxxx>
---
kernel/sched/debug.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index c6c0120ff105..2590041696bc 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -516,7 +516,7 @@ static struct dentry *debugfs_sched;
static void debugfs_fair_server_init(void)
{
struct dentry *d_fair;
- unsigned int cpu;
+ unsigned long cpu;

d_fair = debugfs_create_dir("fair_server", debugfs_sched);
if (!d_fair)
@@ -526,7 +526,7 @@ static void debugfs_fair_server_init(void)
struct dentry *d_cpu;
char buf[32];

- snprintf(buf, sizeof(buf), "cpu%d", cpu);
+ snprintf(buf, sizeof(buf), "cpu%lu", cpu);
d_cpu = debugfs_create_dir(buf, d_fair);

debugfs_create_file("runtime", 0644, d_cpu, (void *) cpu, &fair_server_runtime_fops);
--
2.34.1