aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Liu <[email protected]>2022-07-06 23:17:51 -0400
committerMichael S. Tsirkin <[email protected]>2022-08-11 04:26:07 -0400
commit95bf9798779af166b1d6d184d794834214a1a261 (patch)
tree55499c3ced73d210edda7233b6cc3fce6aaa8590
parentd650f830f38b19039958f3f4504ceeb2b5922da7 (diff)
virtio: Check dev_set_name() return value
It's possible that dev_set_name() returns -ENOMEM, catch and handle this. Signed-off-by: Bo Liu <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]>
-rw-r--r--drivers/virtio/virtio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 7deeed30d1f3..ddd4466da83b 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -428,7 +428,9 @@ int register_virtio_device(struct virtio_device *dev)
goto out;
dev->index = err;
- dev_set_name(&dev->dev, "virtio%u", dev->index);
+ err = dev_set_name(&dev->dev, "virtio%u", dev->index);
+ if (err)
+ goto out_ida_remove;
err = virtio_device_of_init(dev);
if (err)