[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACGkMEujMgP=QbQte6Hjv2DXp7TYJXQvu8uK3=h130pcr6eYsg@mail.gmail.com>
Date: Fri, 8 Jul 2022 14:00:09 +0800
From: Jason Wang <jasowang@...hat.com>
To: Bo Liu <liubo03@...pur.com>
Cc: mst <mst@...hat.com>,
virtualization <virtualization@...ts.linux-foundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] virtio: Check dev_set_name() return value
On Thu, Jul 7, 2022 at 11:18 AM Bo Liu <liubo03@...pur.com> wrote:
>
> It's possible that dev_set_name() returns -ENOMEM, catch and handle this.
>
> Signed-off-by: Bo Liu <liubo03@...pur.com>
Acked-by: Jason Wang <jasowang@...hat.com>
> ---
> drivers/virtio/virtio.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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)
> --
> 2.27.0
>
Powered by blists - more mailing lists