[PATCH 1/2] zImage_ppc64_probe: return 0 instead of 1 in case of success

Simon Horman horms at verge.net.au
Thu Feb 6 02:30:49 EST 2014


On Thu, Feb 06, 2014 at 02:30:43PM +0800, Dave Young wrote:
> All other _probe functions return 0 for probing the kernel
> image successfully, so there's no reason to return 1 here.
> 
> Fix it to return 0 instead.
> 
> Signed-off-by: Dave Young <dyoung at redhat.com>

Thanks, applied.

> ---
>  kexec/arch/ppc64/kexec-zImage-ppc64.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kexec/arch/ppc64/kexec-zImage-ppc64.c b/kexec/arch/ppc64/kexec-zImage-ppc64.c
> index 24a87c6..d084ee5 100644
> --- a/kexec/arch/ppc64/kexec-zImage-ppc64.c
> +++ b/kexec/arch/ppc64/kexec-zImage-ppc64.c
> @@ -36,6 +36,7 @@
>  int zImage_ppc64_probe(FILE *file)
>  {
>  	Elf32_Ehdr elf;
> +	int valid;
>  
>  	if (fseek(file, 0, SEEK_SET) < 0) {
>  		fprintf(stderr, "seek error: %s\n",
> @@ -53,7 +54,7 @@ int zImage_ppc64_probe(FILE *file)
>  		return -1;
>  	}
>  
> -	return (elf.e_ident[EI_MAG0]  == ELFMAG0        &&
> +	valid = (elf.e_ident[EI_MAG0]  == ELFMAG0        &&
>  		elf.e_ident[EI_MAG1]  == ELFMAG1        &&
>  		elf.e_ident[EI_MAG2]  == ELFMAG2        &&
>  		elf.e_ident[EI_MAG3]  == ELFMAG3        &&
> @@ -61,6 +62,8 @@ int zImage_ppc64_probe(FILE *file)
>  		elf.e_ident[EI_DATA]  == ELFDATA2MSB &&
>  		elf.e_type            == ET_EXEC        &&
>  		elf.e_machine         == EM_PPC);
> +
> +	return valid ? 0 : -1;
>  }
>  
>  int zImage_ppc64_load(FILE *file, int UNUSED(argc), char **UNUSED(argv),
> -- 
> 1.8.3.1
> 



More information about the kexec mailing list