All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Zhu Lingshan <lingshan.zhu@intel.com>
Cc: mst <mst@redhat.com>,
	virtualization <virtualization@lists.linux-foundation.org>,
	netdev <netdev@vger.kernel.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] vDPA/ifcvf: fix uninitialized config_vector warning
Date: Wed, 27 Apr 2022 12:22:40 +0800	[thread overview]
Message-ID: <CACGkMEts+u6gnm1hsT=vhgiHE5CiYns4mydTtnr3LkZMJEzVGA@mail.gmail.com> (raw)
In-Reply-To: <20220424072806.1083189-1-lingshan.zhu@intel.com>

On Sun, Apr 24, 2022 at 3:36 PM Zhu Lingshan <lingshan.zhu@intel.com> wrote:
>
> Static checkers are not informed that config_vector is controlled
> by vf->msix_vector_status, which can only be
> MSIX_VECTOR_SHARED_VQ_AND_CONFIG, MSIX_VECTOR_SHARED_VQ_AND_CONFIG
> and MSIX_VECTOR_DEV_SHARED.
>
> This commit uses an "if...elseif...else" code block to tell the
> checkers that it is a complete set, and config_vector can be
> initialized anyway
>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  drivers/vdpa/ifcvf/ifcvf_main.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index 4366320fb68d..9172905fc7ae 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -290,16 +290,16 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter)
>         struct ifcvf_hw *vf = &adapter->vf;
>         int config_vector, ret;
>
> -       if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
> -               return 0;
> -
>         if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG)
> -               /* vector 0 ~ vf->nr_vring for vqs, num vf->nr_vring vector for config interrupt */
>                 config_vector = vf->nr_vring;
> -
> -       if (vf->msix_vector_status ==  MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
> +       else if (vf->msix_vector_status ==  MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
>                 /* vector 0 for vqs and 1 for config interrupt */
>                 config_vector = 1;
> +       else if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
> +               /* re-use the vqs vector */
> +               return 0;
> +       else
> +               return -EINVAL;
>
>         snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
>                  pci_name(pdev));
> --
> 2.31.1
>


WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: Zhu Lingshan <lingshan.zhu@intel.com>
Cc: netdev <netdev@vger.kernel.org>,
	virtualization <virtualization@lists.linux-foundation.org>,
	Dan Carpenter <dan.carpenter@oracle.com>, mst <mst@redhat.com>
Subject: Re: [PATCH] vDPA/ifcvf: fix uninitialized config_vector warning
Date: Wed, 27 Apr 2022 12:22:40 +0800	[thread overview]
Message-ID: <CACGkMEts+u6gnm1hsT=vhgiHE5CiYns4mydTtnr3LkZMJEzVGA@mail.gmail.com> (raw)
In-Reply-To: <20220424072806.1083189-1-lingshan.zhu@intel.com>

On Sun, Apr 24, 2022 at 3:36 PM Zhu Lingshan <lingshan.zhu@intel.com> wrote:
>
> Static checkers are not informed that config_vector is controlled
> by vf->msix_vector_status, which can only be
> MSIX_VECTOR_SHARED_VQ_AND_CONFIG, MSIX_VECTOR_SHARED_VQ_AND_CONFIG
> and MSIX_VECTOR_DEV_SHARED.
>
> This commit uses an "if...elseif...else" code block to tell the
> checkers that it is a complete set, and config_vector can be
> initialized anyway
>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  drivers/vdpa/ifcvf/ifcvf_main.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index 4366320fb68d..9172905fc7ae 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -290,16 +290,16 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter)
>         struct ifcvf_hw *vf = &adapter->vf;
>         int config_vector, ret;
>
> -       if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
> -               return 0;
> -
>         if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG)
> -               /* vector 0 ~ vf->nr_vring for vqs, num vf->nr_vring vector for config interrupt */
>                 config_vector = vf->nr_vring;
> -
> -       if (vf->msix_vector_status ==  MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
> +       else if (vf->msix_vector_status ==  MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
>                 /* vector 0 for vqs and 1 for config interrupt */
>                 config_vector = 1;
> +       else if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
> +               /* re-use the vqs vector */
> +               return 0;
> +       else
> +               return -EINVAL;
>
>         snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
>                  pci_name(pdev));
> --
> 2.31.1
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2022-04-27  4:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24  7:28 [PATCH] vDPA/ifcvf: fix uninitialized config_vector warning Zhu Lingshan
2022-04-27  4:22 ` Jason Wang [this message]
2022-04-27  4:22   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACGkMEts+u6gnm1hsT=vhgiHE5CiYns4mydTtnr3LkZMJEzVGA@mail.gmail.com' \
    --to=jasowang@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=lingshan.zhu@intel.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.