lkml.org 
[lkml]   [2021]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/4] vDPA/ifcvf: Fix return value check for vdpa_alloc_device()
From
Date

在 2021/7/15 下午4:00, Xie Yongji 写道:
> 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>


Acked-by: Jason Wang <jasowang@redhat.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);

\
 
 \ /
  Last update: 2021-07-15 10:09    [W:0.089 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site