All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Wei Yongjun <weiyongjun1@huawei.com>
Cc: Kirti Wankhede <kwankhede@nvidia.com>, <kvm@vger.kernel.org>,
	<kernel-janitors@vger.kernel.org>, Hulk Robot <hulkci@huawei.com>,
	kraxel@redhat.com
Subject: Re: [PATCH -next] samples: vfio-mdev: fix error return code in mdpy_fb_probe()
Date: Wed, 19 May 2021 09:45:12 -0600	[thread overview]
Message-ID: <20210519094512.7ed3ea0f.alex.williamson@redhat.com> (raw)
In-Reply-To: <20210519141559.3031063-1-weiyongjun1@huawei.com>

On Wed, 19 May 2021 14:15:59 +0000
Wei Yongjun <weiyongjun1@huawei.com> wrote:

> Fix to return negative error code -ENOMEM from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  samples/vfio-mdev/mdpy-fb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/samples/vfio-mdev/mdpy-fb.c b/samples/vfio-mdev/mdpy-fb.c
> index 21dbf63d6e41..d4abc0594dbd 100644
> --- a/samples/vfio-mdev/mdpy-fb.c
> +++ b/samples/vfio-mdev/mdpy-fb.c
> @@ -131,8 +131,10 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
>  		 width, height);
>  
>  	info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev);
> -	if (!info)
> +	if (!info) {
> +		ret = -ENOMEM;
>  		goto err_release_regions;
> +	}
>  	pci_set_drvdata(pdev, info);
>  	par = info->par;
>  
> 

I think there's also a question of why the three 'return -EINVAL;' exit
paths between here and the prior call to pci_request_regions() don't
also take this goto.  Thanks,

Alex


  reply	other threads:[~2021-05-19 15:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 14:15 [PATCH -next] samples: vfio-mdev: fix error return code in mdpy_fb_probe() Wei Yongjun
2021-05-19 15:45 ` Alex Williamson [this message]
2021-05-20  5:25   ` Dan Carpenter
2021-05-20  8:10     ` weiyongjun (A)
  -- strict thread matches above, loose matches on Subject: below --
2020-04-27 14:21 Wei Yongjun
2020-04-27 14:21 ` Wei Yongjun

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=20210519094512.7ed3ea0f.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=hulkci@huawei.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kraxel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=weiyongjun1@huawei.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 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.