Re: [RESEND PATCH] intel_th: msu: Fix unused variable warning on arm64 platform
Hi Alex, On 2019/5/20 17:39, Alexander Shishkin wrote: > Shaokun Zhang writes: > >> drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_alloc’: >> drivers/hwtracing/intel_th/msu.c:783:21: warning: unused variable ‘i’ >> [-Wunused-variable] >> int ret = -ENOMEM, i; >> ^ >> drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_free’: >> drivers/hwtracing/intel_th/msu.c:863:6: warning: unused variable ‘i’ >> [-Wunused-variable] >> int i; >> ^ >> Fix this compiler warning on arm64 platform. > > Thank you for taking care of this. > >> Cc: Alexander Shishkin >> Cc: Greg Kroah-Hartman >> Signed-off-by: Shaokun Zhang >> --- >> drivers/hwtracing/intel_th/msu.c | 7 ++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/hwtracing/intel_th/msu.c >> b/drivers/hwtracing/intel_th/msu.c >> index 81bb54fa3ce8..833a5a8f13ad 100644 >> --- a/drivers/hwtracing/intel_th/msu.c >> +++ b/drivers/hwtracing/intel_th/msu.c >> @@ -780,7 +780,10 @@ static int __msc_buffer_win_alloc(struct msc_window >> *win, >> static int msc_buffer_win_alloc(struct msc *msc, unsigned int nr_blocks) >> { >> struct msc_window *win; >> -int ret = -ENOMEM, i; >> +int ret = -ENOMEM; >> +#ifdef CONFIG_X86 >> +int i; >> +#endif > > Can you factor it out into its own function? And one for the other > memory type? So we can maybe keep it to just one #ifdef like > Got it, I will update it in next version soon. Thanks, Shaokun > #ifdef CONFIG_X86 > void msc_buffer_set_uc() > { ... } > void msc_buffer_set_wb() > { ... } > #else /* !X86 */ > static void msc_buffer_set_uc() {} > static void msc_buffer_set_wb() {} > #endif > > Thanks, > -- > Alex > > . >
Re: [RESEND PATCH] intel_th: msu: Fix unused variable warning on arm64 platform
Shaokun Zhang writes: > drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_alloc’: > drivers/hwtracing/intel_th/msu.c:783:21: warning: unused variable ‘i’ > [-Wunused-variable] > int ret = -ENOMEM, i; > ^ > drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_free’: > drivers/hwtracing/intel_th/msu.c:863:6: warning: unused variable ‘i’ > [-Wunused-variable] > int i; > ^ > Fix this compiler warning on arm64 platform. Thank you for taking care of this. > Cc: Alexander Shishkin > Cc: Greg Kroah-Hartman > Signed-off-by: Shaokun Zhang > --- > drivers/hwtracing/intel_th/msu.c | 7 ++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwtracing/intel_th/msu.c > b/drivers/hwtracing/intel_th/msu.c > index 81bb54fa3ce8..833a5a8f13ad 100644 > --- a/drivers/hwtracing/intel_th/msu.c > +++ b/drivers/hwtracing/intel_th/msu.c > @@ -780,7 +780,10 @@ static int __msc_buffer_win_alloc(struct msc_window *win, > static int msc_buffer_win_alloc(struct msc *msc, unsigned int nr_blocks) > { > struct msc_window *win; > - int ret = -ENOMEM, i; > + int ret = -ENOMEM; > +#ifdef CONFIG_X86 > + int i; > +#endif Can you factor it out into its own function? And one for the other memory type? So we can maybe keep it to just one #ifdef like #ifdef CONFIG_X86 void msc_buffer_set_uc() { ... } void msc_buffer_set_wb() { ... } #else /* !X86 */ static void msc_buffer_set_uc() {} static void msc_buffer_set_wb() {} #endif Thanks, -- Alex
[RESEND PATCH] intel_th: msu: Fix unused variable warning on arm64 platform
drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_alloc’: drivers/hwtracing/intel_th/msu.c:783:21: warning: unused variable ‘i’ [-Wunused-variable] int ret = -ENOMEM, i; ^ drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_free’: drivers/hwtracing/intel_th/msu.c:863:6: warning: unused variable ‘i’ [-Wunused-variable] int i; ^ Fix this compiler warning on arm64 platform. Cc: Alexander Shishkin Cc: Greg Kroah-Hartman Signed-off-by: Shaokun Zhang --- drivers/hwtracing/intel_th/msu.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index 81bb54fa3ce8..833a5a8f13ad 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -780,7 +780,10 @@ static int __msc_buffer_win_alloc(struct msc_window *win, static int msc_buffer_win_alloc(struct msc *msc, unsigned int nr_blocks) { struct msc_window *win; - int ret = -ENOMEM, i; + int ret = -ENOMEM; +#ifdef CONFIG_X86 + int i; +#endif if (!nr_blocks) return 0; @@ -860,7 +863,9 @@ static void __msc_buffer_win_free(struct msc *msc, struct msc_window *win) */ static void msc_buffer_win_free(struct msc *msc, struct msc_window *win) { +#ifdef CONFIG_X86 int i; +#endif msc->nr_pages -= win->nr_blocks; -- 2.7.4