linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mips: remove unused variable 'prev_state'
@ 2021-03-31  8:54 Xu Jia
  2021-03-31  9:02 ` Colin Ian King
  2021-03-31  9:22 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Xu Jia @ 2021-03-31  8:54 UTC (permalink / raw)
  To: xujia39, Thomas Bogendoerfer, Andrew Morton, Huacai Chen,
	WANG Xuerui, Dmitry Safonov, Liangliang Huang, Xingxing Su,
	Huang Pei
  Cc: linux-mips, kernel-janitors

GCC reports the following warning with W=1:

arch/mips/kernel/traps.c:1593:17: warning:
 variable 'prev_state' set but not used [-Wunused-but-set-variable]
 1593 |  enum ctx_state prev_state;
      |                 ^~~~~~~~~~

This variable is not used in function , this commit
remove it to fix the warning.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Xu Jia <xujia39@huawei.com>
---
 arch/mips/kernel/traps.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 808b8b61ded1..d1f23ddf0c8c 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1590,10 +1590,8 @@ asmlinkage void do_watch(struct pt_regs *regs)
 asmlinkage void do_mcheck(struct pt_regs *regs)
 {
 	int multi_match = regs->cp0_status & ST0_TS;
-	enum ctx_state prev_state;
 	mm_segment_t old_fs = get_fs();
 
-	prev_state = exception_enter();
 	show_regs(regs);
 
 	if (multi_match) {


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] mips: remove unused variable 'prev_state'
  2021-03-31  8:54 [PATCH -next] mips: remove unused variable 'prev_state' Xu Jia
@ 2021-03-31  9:02 ` Colin Ian King
  2021-03-31  9:22 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2021-03-31  9:02 UTC (permalink / raw)
  To: Xu Jia, Thomas Bogendoerfer, Andrew Morton, Huacai Chen,
	WANG Xuerui, Dmitry Safonov, Liangliang Huang, Xingxing Su,
	Huang Pei
  Cc: linux-mips, kernel-janitors

On 31/03/2021 09:54, Xu Jia wrote:
> GCC reports the following warning with W=1:
> 
> arch/mips/kernel/traps.c:1593:17: warning:
>  variable 'prev_state' set but not used [-Wunused-but-set-variable]
>  1593 |  enum ctx_state prev_state;
>       |                 ^~~~~~~~~~
> 
> This variable is not used in function , this commit
> remove it to fix the warning.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Xu Jia <xujia39@huawei.com>
> ---
>  arch/mips/kernel/traps.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
> index 808b8b61ded1..d1f23ddf0c8c 100644
> --- a/arch/mips/kernel/traps.c
> +++ b/arch/mips/kernel/traps.c
> @@ -1590,10 +1590,8 @@ asmlinkage void do_watch(struct pt_regs *regs)
>  asmlinkage void do_mcheck(struct pt_regs *regs)
>  {
>  	int multi_match = regs->cp0_status & ST0_TS;
> -	enum ctx_state prev_state;
>  	mm_segment_t old_fs = get_fs();
>  
> -	prev_state = exception_enter();

The call to exception_enter() is required for context tracking, so
removing this call is not the correct solution.


>  	show_regs(regs);
>  
>  	if (multi_match) {
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] mips: remove unused variable 'prev_state'
  2021-03-31  8:54 [PATCH -next] mips: remove unused variable 'prev_state' Xu Jia
  2021-03-31  9:02 ` Colin Ian King
@ 2021-03-31  9:22 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-03-31  9:22 UTC (permalink / raw)
  To: Xu Jia
  Cc: Thomas Bogendoerfer, Andrew Morton, Huacai Chen, WANG Xuerui,
	Dmitry Safonov, Liangliang Huang, Xingxing Su, Huang Pei,
	linux-mips, kernel-janitors

On Wed, Mar 31, 2021 at 04:54:58PM +0800, Xu Jia wrote:
> GCC reports the following warning with W=1:
> 
> arch/mips/kernel/traps.c:1593:17: warning:
>  variable 'prev_state' set but not used [-Wunused-but-set-variable]
>  1593 |  enum ctx_state prev_state;
>       |                 ^~~~~~~~~~
> 
> This variable is not used in function , this commit
> remove it to fix the warning.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Xu Jia <xujia39@huawei.com>
> ---
>  arch/mips/kernel/traps.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
> index 808b8b61ded1..d1f23ddf0c8c 100644
> --- a/arch/mips/kernel/traps.c
> +++ b/arch/mips/kernel/traps.c
> @@ -1590,10 +1590,8 @@ asmlinkage void do_watch(struct pt_regs *regs)
>  asmlinkage void do_mcheck(struct pt_regs *regs)
>  {
>  	int multi_match = regs->cp0_status & ST0_TS;
> -	enum ctx_state prev_state;
>  	mm_segment_t old_fs = get_fs();
>  
> -	prev_state = exception_enter();

Pretty sure the exception_enter() is still required...

>  	show_regs(regs);

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-31  9:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-31  8:54 [PATCH -next] mips: remove unused variable 'prev_state' Xu Jia
2021-03-31  9:02 ` Colin Ian King
2021-03-31  9:22 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).