mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Xie Yongji <xieyongji@bytedance.com>,
	mst@redhat.com, jasowang@redhat.com, stefanha@redhat.com
Cc: amit@kernel.org, arei.gonglei@huawei.com, airlied@linux.ie,
	kraxel@redhat.com, jean-philippe@linaro.org, ohad@wizery.com,
	bjorn.andersson@linaro.org, vgoyal@redhat.com, miklos@szeredi.hu,
	lucho@ionkov.net, asmadeus@codewreck.org,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 13/15] virtio-mem: Handle virtio_device_ready() failure
Date: Mon, 17 May 2021 11:48:33 +0200	[thread overview]
Message-ID: <20e1d79f-c3f6-5553-d6b6-1f1051c39ccc@redhat.com> (raw)
In-Reply-To: <20210517093428.670-14-xieyongji@bytedance.com>

On 17.05.21 11:34, Xie Yongji wrote:
> Now virtio_device_ready() will return error if we get
> invalid status. Let's handle this case on probe.
> 
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
> ---
>   drivers/virtio/virtio_mem.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
> index 32a8e359a5c3..1148c392ff94 100644
> --- a/drivers/virtio/virtio_mem.c
> +++ b/drivers/virtio/virtio_mem.c
> @@ -2602,13 +2602,17 @@ static int virtio_mem_probe(struct virtio_device *vdev)
>   	if (rc)
>   		goto out_unreg_mem;
>   
> -	virtio_device_ready(vdev);
> +	rc = virtio_device_ready(vdev);
> +	if (rc)
> +		goto out_unreg_device;
>   
>   	/* trigger a config update to start processing the requested_size */
>   	atomic_set(&vm->config_changed, 1);
>   	queue_work(system_freezable_wq, &vm->wq);
>   
>   	return 0;
> +out_unreg_device:
> +	unregister_virtio_mem_device(vm);
>   out_unreg_mem:
>   	unregister_memory_notifier(&vm->memory_notifier);
>   out_del_resource:
> 

I assume this will really be a corner case to hit, right?


Failing after essentially being done initializing looks sub-optimal, anyhow:

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb


  reply	other threads:[~2021-05-17  9:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17  9:34 [RFC PATCH 00/15] " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 01/15] virtio_config: Add return value to virtio_device_ready() Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 02/15] virtio-blk: Handle virtio_device_ready() failure Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 03/15] virtio_console: " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 04/15] virtio_crypto: " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 05/15] drm/virtio: " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 06/15] virtio-iommu: " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 07/15] virtio-net: " Xie Yongji
2021-05-17  9:34 ` Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 08/15] rpmsg: virtio: " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 10/15] " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 11/15] virtio-balloon: " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 12/15] virtio-input: " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 13/15] virtio-mem: " Xie Yongji
2021-05-17  9:48   ` David Hildenbrand [this message]
2021-05-17 10:08     ` Yongji Xie
2021-05-17  9:34 ` [RFC PATCH 14/15] virtiofs: " Xie Yongji
2021-05-17  9:34 ` [RFC PATCH 15/15] 9p/trans_virtio: " Xie Yongji
2021-05-17  9:53   ` asmadeus

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=20e1d79f-c3f6-5553-d6b6-1f1051c39ccc@redhat.com \
    --to=david@redhat.com \
    --cc=airlied@linux.ie \
    --cc=amit@kernel.org \
    --cc=arei.gonglei@huawei.com \
    --cc=asmadeus@codewreck.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=jasowang@redhat.com \
    --cc=jean-philippe@linaro.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=miklos@szeredi.hu \
    --cc=mst@redhat.com \
    --cc=ohad@wizery.com \
    --cc=stefanha@redhat.com \
    --cc=vgoyal@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

all inboxes | Powered by JetHome®