[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210517093428.670-14-xieyongji@bytedance.com>
Date: Mon, 17 May 2021 17:34:26 +0800
From: Xie Yongji <xieyongji@...edance.com>
To: mst@...hat.com, jasowang@...hat.com, stefanha@...hat.com
Cc: amit@...nel.org, arei.gonglei@...wei.com, airlied@...ux.ie,
kraxel@...hat.com, jean-philippe@...aro.org, ohad@...ery.com,
bjorn.andersson@...aro.org, david@...hat.com, vgoyal@...hat.com,
miklos@...redi.hu, lucho@...kov.net, asmadeus@...ewreck.org,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 13/15] virtio-mem: Handle virtio_device_ready() failure
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@...edance.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:
--
2.11.0
Powered by blists - more mailing lists