[Qemu-devel] [PATCH for-4.0 1/4] checkpatch: fix premature exit when no input or --mailback

Paolo Bonzini posted 4 patches 7 years, 2 months ago
[Qemu-devel] [PATCH for-4.0 1/4] checkpatch: fix premature exit when no input or --mailback
Posted by Paolo Bonzini 7 years, 2 months ago
In some cases, checkpatch's process subroutine is exiting the
whole process.  This is wrong, just return from the subroutine
instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/checkpatch.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index eccd656c41..d58fcb1efd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2869,19 +2869,19 @@ sub process {
 	# If we have no input at all, then there is nothing to report on
 	# so just keep quiet.
 	if ($#rawlines == -1) {
-		exit(0);
+		return 1;
 	}
 
 	# In mailback mode only produce a report in the negative, for
 	# things that appear to be patches.
 	if ($mailback && ($clean == 1 || !$is_patch)) {
-		exit(0);
+		return 1;
 	}
 
 	# This is not a patch, and we are are in 'no-patch' mode so
 	# just keep quiet.
 	if (!$chk_patch && !$is_patch) {
-		exit(0);
+		return 1;
 	}
 
 	if (!$is_patch) {
-- 
2.19.1



Re: [Qemu-devel] [PATCH for-4.0 1/4] checkpatch: fix premature exit when no input or --mailback
Posted by Philippe Mathieu-Daudé 7 years, 2 months ago
On 29/11/18 10:01, Paolo Bonzini wrote:
> In some cases, checkpatch's process subroutine is exiting the
> whole process.  This is wrong, just return from the subroutine
> instead.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  scripts/checkpatch.pl | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index eccd656c41..d58fcb1efd 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2869,19 +2869,19 @@ sub process {
>  	# If we have no input at all, then there is nothing to report on
>  	# so just keep quiet.
>  	if ($#rawlines == -1) {
> -		exit(0);
> +		return 1;
>  	}
>  
>  	# In mailback mode only produce a report in the negative, for
>  	# things that appear to be patches.
>  	if ($mailback && ($clean == 1 || !$is_patch)) {
> -		exit(0);
> +		return 1;
>  	}
>  
>  	# This is not a patch, and we are are in 'no-patch' mode so
>  	# just keep quiet.
>  	if (!$chk_patch && !$is_patch) {
> -		exit(0);
> +		return 1;
>  	}
>  
>  	if (!$is_patch) {
> 

Re: [Qemu-devel] [PATCH for-4.0 1/4] checkpatch: fix premature exit when no input or --mailback
Posted by Markus Armbruster 7 years, 2 months ago
Paolo Bonzini <pbonzini@redhat.com> writes:

> In some cases, checkpatch's process subroutine is exiting the
> whole process.  This is wrong, just return from the subroutine
> instead.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  scripts/checkpatch.pl | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index eccd656c41..d58fcb1efd 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2869,19 +2869,19 @@ sub process {
>  	# If we have no input at all, then there is nothing to report on
>  	# so just keep quiet.
>  	if ($#rawlines == -1) {
> -		exit(0);
> +		return 1;
>  	}
>  
>  	# In mailback mode only produce a report in the negative, for
>  	# things that appear to be patches.
>  	if ($mailback && ($clean == 1 || !$is_patch)) {
> -		exit(0);
> +		return 1;
>  	}
>  
>  	# This is not a patch, and we are are in 'no-patch' mode so
>  	# just keep quiet.
>  	if (!$chk_patch && !$is_patch) {
> -		exit(0);
> +		return 1;
>  	}
>  
>  	if (!$is_patch) {

Would this make sense for Linux's checkpatch.pl, too?