bugifx: fix some wrong usage of ATTRIBUTE_NONNULL

Daniel Henrique Barboza danielhb413 at gmail.com
Mon Jun 8 17:52:25 UTC 2020


For the attached patch:


Reviewed-by: Daniel Henrique Barboza <danielhb413 at gmail.com>

On 6/6/20 7:30 AM, Bihong Yu wrote:
> There are some wrong usage of ATTRIBUTE_NONNULL, which may cause the compilation fail. The
> ATTRIBUTE_NONNULL is the define of __attribute__((__nonnull__(m))), which declares that the
> input pointer parameter of funciton should not be NULL. If we declare some input pointer
> parameter of the function is ATTRIBUTE_NONNULL, the function should not redundancy check of
> the pointer parameter. And the ATTRIBUTE_NONNULL can only be using to pointer.
> 
>>From 55cd85345b2dc50f44c1e382563482d40142382b Mon Sep 17 00:00:00 2001
> From: yubihong <yubihong at huawei.com>
> Date: Fri, 24 Apr 2020 17:44:43 +0800
> Subject: [PATCH] qemu: fix code format problem
> 
> Signed-off-by:Yu Bihong <yubihong at huawei.com>
> ---
>   src/libvirt-domain.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index a12809c..d659f1b 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -8194,11 +8194,11 @@ virDomainAttachDevice(virDomainPtr domain, const char *xml)
>       virCheckReadOnlyGoto(conn->flags, error);
> 
>       if (conn->driver->domainAttachDevice) {
> -       int ret;
> -       ret = conn->driver->domainAttachDevice(domain, xml);
> -       if (ret < 0)
> -          goto error;
> -       return ret;
> +        int ret;
> +        ret = conn->driver->domainAttachDevice(domain, xml);
> +        if (ret < 0)
> +            goto error;
> +        return ret;
>       }
> 
>       virReportUnsupportedError();
> @@ -8299,9 +8299,9 @@ virDomainDetachDevice(virDomainPtr domain, const char *xml)
>       if (conn->driver->domainDetachDevice) {
>           int ret;
>           ret = conn->driver->domainDetachDevice(domain, xml);
> -         if (ret < 0)
> -             goto error;
> -         return ret;
> +        if (ret < 0)
> +            goto error;
> +        return ret;
>        }
> 
>       virReportUnsupportedError();
> 




More information about the libvir-list mailing list