mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
virtio: release virtio index when fail to device_register
index can be reused by other virtio device. Cc: [email protected] Signed-off-by: weiping zhang <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
This commit is contained in:
parent
23f1b8d938
commit
e60ea67bb6
1 changed files with 2 additions and 0 deletions
|
|
@ -333,6 +333,8 @@ int register_virtio_device(struct virtio_device *dev)
|
|||
/* device_register() causes the bus infrastructure to look for a
|
||||
* matching driver. */
|
||||
err = device_register(&dev->dev);
|
||||
if (err)
|
||||
ida_simple_remove(&virtio_index_ida, dev->index);
|
||||
out:
|
||||
if (err)
|
||||
virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);
|
||||
|
|
|
|||
Loading…
Reference in a new issue