Skip to content

Commit

Permalink
xtensa: fix xtensa_wsr always writing 0
Browse files Browse the repository at this point in the history
commit a3d0245 upstream.

The commit cad6fad ("xtensa: clean up WSR*/RSR*/get_sr/set_sr")
replaced 'WSR' macro in the function xtensa_wsr with 'xtensa_set_sr',
but variable 'v' in the xtensa_set_sr body shadowed the argument 'v'
passed to it, resulting in wrong value written to debug registers.

Fix that by removing intermediate variable from the xtensa_set_sr
macro body.

Cc: stable@vger.kernel.org
Fixes: cad6fad ("xtensa: clean up WSR*/RSR*/get_sr/set_sr")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
jcmvbkbc authored and gregkh committed Apr 8, 2022
1 parent e392959 commit bab3fb0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/xtensa/include/asm/processor.h
Expand Up @@ -246,8 +246,8 @@ extern unsigned long __get_wchan(struct task_struct *p);

#define xtensa_set_sr(x, sr) \
({ \
unsigned int v = (unsigned int)(x); \
__asm__ __volatile__ ("wsr %0, "__stringify(sr) :: "a"(v)); \
__asm__ __volatile__ ("wsr %0, "__stringify(sr) :: \
"a"((unsigned int)(x))); \
})

#define xtensa_get_sr(sr) \
Expand Down

0 comments on commit bab3fb0

Please sign in to comment.