From: Stefano Garzarella <sgarzare@redhat.com>
To: Xie Yongji <xieyongji@bytedance.com>
Cc: virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, dan.carpenter@oracle.com,
mst@redhat.com
Subject: Re: [PATCH 3/4] vDPA/ifcvf: Fix return value check for vdpa_alloc_device()
Date: Mon, 26 Jul 2021 11:28:55 +0200 [thread overview]
Message-ID: <20210726092855.xg3yicwltfwozz6y@steredhat> (raw)
In-Reply-To: <20210715080026.242-3-xieyongji@bytedance.com>
On Thu, Jul 15, 2021 at 04:00:25PM +0800, Xie Yongji wrote:
>The vdpa_alloc_device() returns an error pointer upon
>failure, not NULL. To handle the failure correctly, this
>replaces NULL check with IS_ERR() check and propagate the
>error upwards.
>
>Fixes: 5a2414bc454e ("virtio: Intel IFC VF driver for VDPA")
>Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
>---
> drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
>index 21b78f1cd521..351c6cfb24c3 100644
>--- a/drivers/vdpa/ifcvf/ifcvf_main.c
>+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
>@@ -493,9 +493,9 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>
> adapter = vdpa_alloc_device(struct ifcvf_adapter, vdpa,
> dev, &ifc_vdpa_ops, NULL);
>- if (adapter == NULL) {
>+ if (IS_ERR(adapter)) {
> IFCVF_ERR(pdev, "Failed to allocate vDPA structure");
>- return -ENOMEM;
>+ return PTR_ERR(adapter);
> }
>
> pci_set_master(pdev);
>--
>2.11.0
>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-07-26 9:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210715080026.242-1-xieyongji@bytedance.com>
[not found] ` <20210715080026.242-3-xieyongji@bytedance.com>
2021-07-15 8:09 ` [PATCH 3/4] vDPA/ifcvf: Fix return value check for vdpa_alloc_device() Jason Wang
2021-07-26 9:28 ` Stefano Garzarella [this message]
2021-07-26 9:28 ` [PATCH 1/4] vdpa_sim: " Stefano Garzarella
[not found] ` <20210715080026.242-2-xieyongji@bytedance.com>
2021-07-15 8:08 ` [PATCH 2/4] vp_vdpa: " Jason Wang
2021-07-26 9:28 ` Stefano Garzarella
[not found] ` <20210715080026.242-4-xieyongji@bytedance.com>
2021-07-15 8:10 ` [PATCH 4/4] vdpa: Add documentation for vdpa_alloc_device() macro Jason Wang
2021-07-26 9:29 ` Stefano Garzarella
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=20210726092855.xg3yicwltfwozz6y@steredhat \
--to=sgarzare@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xieyongji@bytedance.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox