vfio: ccw: Register mediated device once all structures are initialized
authorPierre Morel <pmorel@linux.ibm.com>
Thu, 25 Oct 2018 17:15:20 +0000 (19:15 +0200)
committerCornelia Huck <cohuck@redhat.com>
Tue, 13 Nov 2018 10:45:17 +0000 (11:45 +0100)
Let's register the mediated device when all the data structures
which could be used are initialized.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Message-Id: <1540487720-11634-3-git-send-email-pmorel@linux.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
drivers/s390/cio/vfio_ccw_drv.c

index edbf542d82afbe784e6c53bacd53d2b41c44a036..a10cec0e86eb495ffd45f3854a09e1a76bf3e598 100644 (file)
@@ -134,14 +134,14 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
        if (ret)
                goto out_free;
 
-       ret = vfio_ccw_mdev_reg(sch);
-       if (ret)
-               goto out_disable;
-
        INIT_WORK(&private->io_work, vfio_ccw_sch_io_todo);
        atomic_set(&private->avail, 1);
        private->state = VFIO_CCW_STATE_STANDBY;
 
+       ret = vfio_ccw_mdev_reg(sch);
+       if (ret)
+               goto out_disable;
+
        return 0;
 
 out_disable: