diff mbox series

sparc: Move va_end() before exit

Message ID 20241204112145.6987-1-liujing@cmss.chinamobile.com
State New
Headers show
Series sparc: Move va_end() before exit | expand

Commit Message

liujing Dec. 4, 2024, 11:21 a.m. UTC
This patch makes a minor adjustment by moving the va_end call before
exit. Since the exit() function terminates the program, any code
after exit(1) is unreachable thus notexecuted. Placing va_end before
exit ensures that the va_list is properly cleaned up.

Signed-off-by: liujing <liujing@cmss.chinamobile.com>

Comments

Andreas Larsson Dec. 6, 2024, 8:19 a.m. UTC | #1
On 2024-12-04 12:21, liujing wrote:
> [PATCH] sparc: Move va_end() before exit

Please use exit() rather than exit also here. As it is the calls you are
swapping order of and not an implementation perhaps phrase it "Call
va_end()..." or "Move va_end() call..." or something like that. Please
also indicate where this change is happening, not just in sparc.

> This patch makes a minor adjustment by moving the va_end call before
> exit. Since the exit() function terminates the program, any code
> after exit(1) is unreachable thus notexecuted. Placing va_end before
> exit ensures that the va_list is properly cleaned up.

Please also describe how you found this.

> Signed-off-by: liujing <liujing@cmss.chinamobile.com>
> 
> diff --git a/arch/sparc/vdso/vdso2c.c b/arch/sparc/vdso/vdso2c.c
> index dc81240aab6f..372e3330850a 100644
> --- a/arch/sparc/vdso/vdso2c.c
> +++ b/arch/sparc/vdso/vdso2c.c
> @@ -90,8 +90,8 @@ static void fail(const char *format, ...)
>  	vfprintf(stderr, format, ap);
>  	if (outfilename)
>  		unlink(outfilename);
> -	exit(1);
>  	va_end(ap);
> +	exit(1);
>  }
>  
>  /*

Cheers,
Andreas
diff mbox series

Patch

diff --git a/arch/sparc/vdso/vdso2c.c b/arch/sparc/vdso/vdso2c.c
index dc81240aab6f..372e3330850a 100644
--- a/arch/sparc/vdso/vdso2c.c
+++ b/arch/sparc/vdso/vdso2c.c
@@ -90,8 +90,8 @@  static void fail(const char *format, ...)
 	vfprintf(stderr, format, ap);
 	if (outfilename)
 		unlink(outfilename);
-	exit(1);
 	va_end(ap);
+	exit(1);
 }
 
 /*