qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH v2 3/7] block/sheepdog: remove spur


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v2 3/7] block/sheepdog: remove spurious NULL check
Date: Wed, 30 Aug 2017 14:37:15 -0300

On Wed, Aug 30, 2017 at 1:57 PM, Jeff Cody <address@hidden> wrote:
> 'tag' is already checked in the lines immediately preceding this check,
> and set to non-NULL if NULL.  No need to check again, it hasn't changed.
>
> Signed-off-by: Jeff Cody <address@hidden>
> ---
>  block/sheepdog.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index abb2e79..bbbfa72 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -1632,7 +1632,7 @@ static int sd_open(BlockDriverState *bs, QDict 
> *options, int flags,
>      if (!tag) {
>          tag = "";
>      }
> -    if (tag && strlen(tag) >= SD_MAX_VDI_TAG_LEN) {
> +    if (strlen(tag) >= SD_MAX_VDI_TAG_LEN) {

you can even prepend an 'else'! :D

>          error_setg(errp, "value of parameter 'tag' is too long");
>          ret = -EINVAL;
>          goto err_no_fd;
> --
> 2.9.5
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]