From: Bo Liu Date: Thu, 7 Jul 2022 03:17:51 +0000 (-0400) Subject: virtio: Check dev_set_name() return value X-Git-Tag: v6.1-rc5~611^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=95bf9798779af166b1d6d184d794834214a1a261;p=platform%2Fkernel%2Flinux-starfive.git 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 Message-Id: <20220707031751.4802-1-liubo03@inspur.com> Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang --- diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 7deeed3..ddd4466 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)