|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 02/10] libxl-pci: clean unused return variable
On Fri, 1 Apr 2016, Paulina Szubarczyk wrote:
> libxl_device_pci_assignable_list returns:
> - list of the libxl_device_pci
> - NULL in case of error
>
> the rc variable is unused as return code.
>
> Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@xxxxxxxxx>
> ---
> tools/libxl/libxl_pci.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
> index 3435ce2..6051ee4 100644
> --- a/tools/libxl/libxl_pci.c
> +++ b/tools/libxl/libxl_pci.c
> @@ -397,12 +397,11 @@ libxl_device_pci
> *libxl_device_pci_assignable_list(libxl_ctx *ctx, int *num)
> libxl_device_pci *pcidevs = NULL, *new, *assigned;
> struct dirent *de;
> DIR *dir;
> - int rc, num_assigned;
> + int num_assigned;
>
> *num = 0;
>
> - rc = get_all_assigned_devices(gc, &assigned, &num_assigned);
> - if ( rc )
> + if ( get_all_assigned_devices(gc, &assigned, &num_assigned) )
> goto out;
This is against libxl coding style, see the file in
tools/libxl/CODING_STYLE:
* Function calls which might fail (ie most function calls) are
handled by putting the return/status value into a variable, and
then checking it in a separate statement:
char *dompath = libxl__xs_get_dompath(gc, bl->domid);
if (!dompath) { rc = ERROR_FAIL; goto out; }
The only issues with this piece of code is the extra spaces inside the
parentheses AFAICT.
There are other things that you can fix in this function, like removing
the extra "out_closedir" label. There are cleaner ways to achieve the same
using a single "out" label.
Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |