* [PATCH][next] perf/x86/rapl: replace 0 with NULL to initialize pointers
@ 2022-01-25 20:14 Colin Ian King
2022-01-25 20:29 ` Randy Dunlap
2022-01-25 21:32 ` Peter Zijlstra
0 siblings, 2 replies; 4+ messages in thread
From: Colin Ian King @ 2022-01-25 20:14 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
H . Peter Anvin, linux-perf-users
Cc: kernel-janitors, linux-kernel
Pointers should be initialized with NULL rather than zero. Fix these.
Cleans up sparse warning:
arch/x86/events/rapl.c:540:59: warning: Using plain integer as NULL pointer
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
arch/x86/events/rapl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
index 77e3a47af5ad..7d70690fded5 100644
--- a/arch/x86/events/rapl.c
+++ b/arch/x86/events/rapl.c
@@ -537,11 +537,11 @@ static struct perf_msr intel_rapl_spr_msrs[] = {
* - want to use same event codes across both architectures
*/
static struct perf_msr amd_rapl_msrs[] = {
- [PERF_RAPL_PP0] = { 0, &rapl_events_cores_group, 0, false, 0 },
+ [PERF_RAPL_PP0] = { 0, &rapl_events_cores_group, NULL, false, 0 },
[PERF_RAPL_PKG] = { MSR_AMD_PKG_ENERGY_STATUS, &rapl_events_pkg_group, test_msr, false, RAPL_MSR_MASK },
- [PERF_RAPL_RAM] = { 0, &rapl_events_ram_group, 0, false, 0 },
- [PERF_RAPL_PP1] = { 0, &rapl_events_gpu_group, 0, false, 0 },
- [PERF_RAPL_PSYS] = { 0, &rapl_events_psys_group, 0, false, 0 },
+ [PERF_RAPL_RAM] = { 0, &rapl_events_ram_group, NULL, false, 0 },
+ [PERF_RAPL_PP1] = { 0, &rapl_events_gpu_group, NULL, false, 0 },
+ [PERF_RAPL_PSYS] = { 0, &rapl_events_psys_group, NULL, false, 0 },
};
static int rapl_cpu_offline(unsigned int cpu)
--
2.33.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][next] perf/x86/rapl: replace 0 with NULL to initialize pointers
2022-01-25 20:14 [PATCH][next] perf/x86/rapl: replace 0 with NULL to initialize pointers Colin Ian King
@ 2022-01-25 20:29 ` Randy Dunlap
2022-01-25 21:32 ` Peter Zijlstra
1 sibling, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2022-01-25 20:29 UTC (permalink / raw)
To: Colin Ian King, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, Thomas Gleixner, Borislav Petkov,
Dave Hansen, x86, H . Peter Anvin, linux-perf-users
Cc: kernel-janitors, linux-kernel
On 1/25/22 12:14, Colin Ian King wrote:
> Pointers should be initialized with NULL rather than zero. Fix these.
> Cleans up sparse warning:
>
> arch/x86/events/rapl.c:540:59: warning: Using plain integer as NULL pointer
also was
Reported-by: kernel test robot <lkp@intel.com>
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> arch/x86/events/rapl.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
> index 77e3a47af5ad..7d70690fded5 100644
> --- a/arch/x86/events/rapl.c
> +++ b/arch/x86/events/rapl.c
> @@ -537,11 +537,11 @@ static struct perf_msr intel_rapl_spr_msrs[] = {
> * - want to use same event codes across both architectures
> */
> static struct perf_msr amd_rapl_msrs[] = {
> - [PERF_RAPL_PP0] = { 0, &rapl_events_cores_group, 0, false, 0 },
> + [PERF_RAPL_PP0] = { 0, &rapl_events_cores_group, NULL, false, 0 },
> [PERF_RAPL_PKG] = { MSR_AMD_PKG_ENERGY_STATUS, &rapl_events_pkg_group, test_msr, false, RAPL_MSR_MASK },
> - [PERF_RAPL_RAM] = { 0, &rapl_events_ram_group, 0, false, 0 },
> - [PERF_RAPL_PP1] = { 0, &rapl_events_gpu_group, 0, false, 0 },
> - [PERF_RAPL_PSYS] = { 0, &rapl_events_psys_group, 0, false, 0 },
> + [PERF_RAPL_RAM] = { 0, &rapl_events_ram_group, NULL, false, 0 },
> + [PERF_RAPL_PP1] = { 0, &rapl_events_gpu_group, NULL, false, 0 },
> + [PERF_RAPL_PSYS] = { 0, &rapl_events_psys_group, NULL, false, 0 },
> };
>
> static int rapl_cpu_offline(unsigned int cpu)
--
~Randy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] perf/x86/rapl: replace 0 with NULL to initialize pointers
2022-01-25 20:14 [PATCH][next] perf/x86/rapl: replace 0 with NULL to initialize pointers Colin Ian King
2022-01-25 20:29 ` Randy Dunlap
@ 2022-01-25 21:32 ` Peter Zijlstra
2022-01-26 11:33 ` Dan Carpenter
1 sibling, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2022-01-25 21:32 UTC (permalink / raw)
To: Colin Ian King
Cc: Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Namhyung Kim, Thomas Gleixner,
Borislav Petkov, Dave Hansen, x86, H . Peter Anvin,
linux-perf-users, kernel-janitors, linux-kernel
On Tue, Jan 25, 2022 at 08:14:03PM +0000, Colin Ian King wrote:
> Pointers should be initialized with NULL rather than zero. Fix these.
Why ? This isn't C++, heck, this isn't even C, this is the kernel, we
hard rely on NULL being 0.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][next] perf/x86/rapl: replace 0 with NULL to initialize pointers
2022-01-25 21:32 ` Peter Zijlstra
@ 2022-01-26 11:33 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-01-26 11:33 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Colin Ian King, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
H . Peter Anvin, linux-perf-users, kernel-janitors, linux-kernel
On Tue, Jan 25, 2022 at 10:32:31PM +0100, Peter Zijlstra wrote:
> On Tue, Jan 25, 2022 at 08:14:03PM +0000, Colin Ian King wrote:
> > Pointers should be initialized with NULL rather than zero. Fix these.
>
> Why ? This isn't C++, heck, this isn't even C, this is the kernel, we
> hard rely on NULL being 0.
It's a Sparse warning.
https://www.spinics.net/lists/linux-sparse/msg10066.html
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-26 11:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 20:14 [PATCH][next] perf/x86/rapl: replace 0 with NULL to initialize pointers Colin Ian King
2022-01-25 20:29 ` Randy Dunlap
2022-01-25 21:32 ` Peter Zijlstra
2022-01-26 11:33 ` Dan Carpenter
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.