Re: [PATCH kvm-unit-tests 1/2] arm/powerpc: setup: apply assert_msg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22.05.2017 20:18, Andrew Jones wrote:
> Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
> ---
>  lib/arm/setup.c     | 7 ++-----
>  lib/powerpc/setup.c | 8 ++------
>  2 files changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/lib/arm/setup.c b/lib/arm/setup.c
> index 689c211d3018..9974b4c131dd 100644
> --- a/lib/arm/setup.c
> +++ b/lib/arm/setup.c
> @@ -48,11 +48,8 @@ static void cpu_set(int fdtnode __unused, u64 regval, void *info __unused)
>  {
>  	int cpu = nr_cpus++;
>  
> -	if (cpu >= NR_CPUS) {
> -		printf("Number cpus exceeds maximum supported (%d).\n",
> -			NR_CPUS);
> -		assert(0);
> -	}
> +	assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS);
> +
>  	cpus[cpu] = regval;
>  	set_cpu_present(cpu, true);
>  }
> diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c
> index 8d44311cac3b..7157bcb70094 100644
> --- a/lib/powerpc/setup.c
> +++ b/lib/powerpc/setup.c
> @@ -50,15 +50,11 @@ static void cpu_set(int fdtnode, u64 regval, void *info)
>  	struct cpu_set_params *params = info;
>  	int cpu = nr_cpus++;
>  
> -	if (cpu >= NR_CPUS) {
> -		printf("Number cpus exceeds maximum supported (%d).\n",
> -			NR_CPUS);
> -		assert(0);
> -	}
> +	assert_msg(cpu < NR_CPUS, "Number cpus exceeds maximum supported (%d).", NR_CPUS);
> +
>  	cpus[cpu] = regval;
>  
>  	/* set exception stack address for this CPU (in SPGR0) */
> -
>  	asm volatile ("mtsprg0 %[addr]" ::
>  		      [addr] "r" (exception_stack[cpu + 1]));

Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux