diff options
author | Bo Liu <liubo03@inspur.com> | 2022-07-07 05:17:51 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-08-11 10:26:07 +0200 |
commit | 95bf9798779af166b1d6d184d794834214a1a261 (patch) | |
tree | 55499c3ced73d210edda7233b6cc3fce6aaa8590 /drivers/virtio | |
parent | tools/virtio: fix build (diff) | |
download | linux-95bf9798779af166b1d6d184d794834214a1a261.tar.xz linux-95bf9798779af166b1d6d184d794834214a1a261.zip |
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 <liubo03@inspur.com>
Message-Id: <20220707031751.4802-1-liubo03@inspur.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio.c | 4 |
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) |