[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACGkMEszTmn1nO=qkzqGawtjq1f6AJK_U63Tw96+PU02C3Cdew@mail.gmail.com>
Date: Thu, 23 Dec 2021 13:58:46 +0800
From: Jason Wang <jasowang@...hat.com>
To: Peng Hao <flyingpenghao@...il.com>
Cc: mst <mst@...hat.com>,
virtualization <virtualization@...ts.linux-foundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] virtio/virtio_pci_legacy_dev: ensure the correct return value
On Wed, Dec 22, 2021 at 7:21 PM Peng Hao <flyingpenghao@...il.com> wrote:
>
> When pci_iomap return NULL, the return value is zero.
>
> Signed-off-by: Peng Hao <flyingpeng@...cent.com>
> ---
Acked-by: Jason Wang <jasowang@...hat.com>
> drivers/virtio/virtio_pci_legacy_dev.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_pci_legacy_dev.c b/drivers/virtio/virtio_pci_legacy_dev.c
> index 9b97680dd02b..677d1f68bc9b 100644
> --- a/drivers/virtio/virtio_pci_legacy_dev.c
> +++ b/drivers/virtio/virtio_pci_legacy_dev.c
> @@ -45,8 +45,10 @@ int vp_legacy_probe(struct virtio_pci_legacy_device *ldev)
> return rc;
>
> ldev->ioaddr = pci_iomap(pci_dev, 0, 0);
> - if (!ldev->ioaddr)
> + if (!ldev->ioaddr) {
> + rc = -EIO;
> goto err_iomap;
> + }
>
> ldev->isr = ldev->ioaddr + VIRTIO_PCI_ISR;
>
> --
> 2.27.0
>
Powered by blists - more mailing lists