From 9db1d31388ad2ba336d0a2906d5b83f688fbf545 Mon Sep 17 00:00:00 2001 From: Yimin Peng Date: Thu, 29 Oct 2020 16:30:35 +0800 Subject: [PATCH] i2c: virtio: Register i2c adapter after virtio queue ready Make sure the right sequence of virtio i2c access. Change-Id: I786ee11c5a3166db52531e271a22d53cc607e9a6 Signed-off-by: Yimin Peng --- drivers/i2c/busses/virtio-i2c.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/virtio-i2c.c b/drivers/i2c/busses/virtio-i2c.c index 41345f0aaf63..59b206c561b3 100644 --- a/drivers/i2c/busses/virtio-i2c.c +++ b/drivers/i2c/busses/virtio-i2c.c @@ -292,13 +292,14 @@ static int virti2c_probe(struct virtio_device *vdev) if (err) goto err_init_vq; + virtio_device_ready(vdev); + + virtqueue_enable_cb(vi2c->vq); + err = virti2c_init_hw(vdev, vi2c); if (err) goto err_init_hw; - virtio_device_ready(vdev); - - virtqueue_enable_cb(vi2c->vq); return 0; err_init_hw: