[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210517093428.670-13-xieyongji@bytedance.com>
Date: Mon, 17 May 2021 17:34:25 +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 12/15] virtio-input: Handle virtio_device_ready() failure
Now virtio_device_ready() will return error if we get
invalid status. Let's handle this case in both probe
and resume paths.
Signed-off-by: Xie Yongji <xieyongji@...edance.com>
---
drivers/virtio/virtio_input.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
index f83f8e556fba..a94940efad7a 100644
--- a/drivers/virtio/virtio_input.c
+++ b/drivers/virtio/virtio_input.c
@@ -312,7 +312,10 @@ static int virtinput_probe(struct virtio_device *vdev)
}
}
- virtio_device_ready(vdev);
+ err = virtio_device_ready(vdev);
+ if (err)
+ goto err_mt_init_slots;
+
vi->ready = true;
err = input_register_device(vi->idev);
if (err)
@@ -375,7 +378,11 @@ static int virtinput_restore(struct virtio_device *vdev)
if (err)
return err;
- virtio_device_ready(vdev);
+ err = virtio_device_ready(vdev);
+ if (err) {
+ vdev->config->del_vqs(vdev);
+ return err;
+ }
vi->ready = true;
virtinput_fill_evt(vi);
return 0;
--
2.11.0
Powered by blists - more mailing lists