2019-05-20 05:19:39

by Zhangshaokun

[permalink] [raw]
Subject: [PATCH] intel_th: msu: Fix unused variable warning on arm64 platform

Fix this compiler warning on arm64 platform.

Cc: Alexander Shishkin <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Shaokun Zhang <[email protected]>
---
drivers/hwtracing/intel_th/msu.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index 81bb54fa3ce8..e15ed5c308e1 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -780,7 +780,7 @@ 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;

if (!nr_blocks)
return 0;
@@ -812,7 +812,7 @@ static int msc_buffer_win_alloc(struct msc *msc, unsigned int nr_blocks)
goto err_nomem;

#ifdef CONFIG_X86
- for (i = 0; i < ret; i++)
+ for (int i = 0; i < ret; i++)
/* Set the page as uncached */
set_memory_uc((unsigned long)msc_win_block(win, i), 1);
#endif
@@ -860,8 +860,6 @@ 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)
{
- int i;
-
msc->nr_pages -= win->nr_blocks;

list_del(&win->entry);
@@ -871,7 +869,7 @@ static void msc_buffer_win_free(struct msc *msc, struct msc_window *win)
}

#ifdef CONFIG_X86
- for (i = 0; i < win->nr_blocks; i++)
+ for (int i = 0; i < win->nr_blocks; i++)
/* Reset the page to write-back */
set_memory_wb((unsigned long)msc_win_block(win, i), 1);
#endif
--
2.7.4



2019-05-20 08:31:18

by Zhangshaokun

[permalink] [raw]
Subject: Re: [PATCH] intel_th: msu: Fix unused variable warning on arm64 platform

please ignore this patch, I will update it and resend it.

On 2019/5/20 11:23, Shaokun Zhang wrote:
> Fix this compiler warning on arm64 platform.
>
> Cc: Alexander Shishkin <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Shaokun Zhang <[email protected]>
> ---
> drivers/hwtracing/intel_th/msu.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
> index 81bb54fa3ce8..e15ed5c308e1 100644
> --- a/drivers/hwtracing/intel_th/msu.c
> +++ b/drivers/hwtracing/intel_th/msu.c
> @@ -780,7 +780,7 @@ 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;
>
> if (!nr_blocks)
> return 0;
> @@ -812,7 +812,7 @@ static int msc_buffer_win_alloc(struct msc *msc, unsigned int nr_blocks)
> goto err_nomem;
>
> #ifdef CONFIG_X86
> - for (i = 0; i < ret; i++)
> + for (int i = 0; i < ret; i++)
> /* Set the page as uncached */
> set_memory_uc((unsigned long)msc_win_block(win, i), 1);
> #endif
> @@ -860,8 +860,6 @@ 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)
> {
> - int i;
> -
> msc->nr_pages -= win->nr_blocks;
>
> list_del(&win->entry);
> @@ -871,7 +869,7 @@ static void msc_buffer_win_free(struct msc *msc, struct msc_window *win)
> }
>
> #ifdef CONFIG_X86
> - for (i = 0; i < win->nr_blocks; i++)
> + for (int i = 0; i < win->nr_blocks; i++)
> /* Reset the page to write-back */
> set_memory_wb((unsigned long)msc_win_block(win, i), 1);
> #endif
>