* [PATCH] virtio: Check dev_set_name() return value
@ 2022-07-07 3:17 Bo Liu
2022-07-08 6:00 ` Jason Wang
0 siblings, 1 reply; 3+ messages in thread
From: Bo Liu @ 2022-07-07 3:17 UTC (permalink / raw)
To: mst, jasowang; +Cc: virtualization, linux-kernel, Bo Liu
It's possible that dev_set_name() returns -ENOMEM, catch and handle this.
Signed-off-by: Bo Liu <liubo03@inspur.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] virtio: Check dev_set_name() return value
2022-07-07 3:17 [PATCH] virtio: Check dev_set_name() return value Bo Liu
@ 2022-07-08 6:00 ` Jason Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2022-07-08 6:00 UTC (permalink / raw)
To: Bo Liu; +Cc: mst, virtualization, linux-kernel
On Thu, Jul 7, 2022 at 11:18 AM Bo Liu <liubo03@inspur.com> wrote:
>
> It's possible that dev_set_name() returns -ENOMEM, catch and handle this.
>
> Signed-off-by: Bo Liu <liubo03@inspur.com>
Acked-by: Jason Wang <jasowang@redhat.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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] virtio: Check dev_set_name() return value
@ 2022-07-08 6:00 ` Jason Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2022-07-08 6:00 UTC (permalink / raw)
To: Bo Liu; +Cc: virtualization, linux-kernel, mst
On Thu, Jul 7, 2022 at 11:18 AM Bo Liu <liubo03@inspur.com> wrote:
>
> It's possible that dev_set_name() returns -ENOMEM, catch and handle this.
>
> Signed-off-by: Bo Liu <liubo03@inspur.com>
Acked-by: Jason Wang <jasowang@redhat.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
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-08 6:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 3:17 [PATCH] virtio: Check dev_set_name() return value Bo Liu
2022-07-08 6:00 ` Jason Wang
2022-07-08 6:00 ` Jason Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.