Re: [kvm-unit-tests PATCH 3/7] lib: chr-testdev: Make chr_testdev_init() return status

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

 



On Thu, Jan 24, 2019 at 11:16:30AM +0000, Alexandru Elisei wrote:
> Make chr_testdev_init() return 0 (success) if the virtio console was
> initialized properly, otherwise return -1 (failure).
> 
> Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>
> ---
>  lib/chr-testdev.h | 2 +-
>  lib/chr-testdev.c | 8 +++++---
>  2 files changed, 6 insertions(+), 4 deletions(-)

This patch isn't necessary. I'll explain why in patch 5/7.

> 
> diff --git a/lib/chr-testdev.h b/lib/chr-testdev.h
> index ffd9a851aa9b..fdd0582e2da1 100644
> --- a/lib/chr-testdev.h
> +++ b/lib/chr-testdev.h
> @@ -9,6 +9,6 @@
>   *
>   * This work is licensed under the terms of the GNU LGPL, version 2.
>   */
> -extern void chr_testdev_init(void);
> +extern int chr_testdev_init(void);
>  extern void chr_testdev_exit(int code);
>  #endif
> diff --git a/lib/chr-testdev.c b/lib/chr-testdev.c
> index 6890f63c8b29..26e14301e3db 100644
> --- a/lib/chr-testdev.c
> +++ b/lib/chr-testdev.c
> @@ -47,7 +47,7 @@ out:
>  	spin_unlock(&lock);
>  }
>  
> -void chr_testdev_init(void)
> +int chr_testdev_init(void)
>  {
>  	const char *io_names[] = { "input", "output" };
>  	struct virtqueue *vqs[2];
> @@ -57,7 +57,7 @@ void chr_testdev_init(void)
>  	if (vcon == NULL) {
>  		printf("%s: %s: can't find a virtio-console\n",
>  				__func__, TESTDEV_NAME);
> -		return;
> +		return -1;
>  	}
>  
>  	ret = vcon->config->find_vqs(vcon, 2, vqs, NULL, io_names);
> @@ -65,9 +65,11 @@ void chr_testdev_init(void)
>  		printf("%s: %s: can't init virtqueues\n",
>  				__func__, TESTDEV_NAME);
>  		vcon = NULL;
> -		return;
> +		return -1;
>  	}
>  
>  	in_vq = vqs[0];
>  	out_vq = vqs[1];
> +
> +	return 0;
>  }
> -- 
> 2.17.0
> 
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux