* [PATCH] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
@ 2022-06-02 0:55 chengkaitao
2022-06-08 8:11 ` Jason Wang
0 siblings, 1 reply; 3+ messages in thread
From: chengkaitao @ 2022-06-02 0:55 UTC (permalink / raw)
To: mst, jasowang; +Cc: virtualization, linux-kernel, smcdef, chengkaitao
From: chengkaitao <pilgrimtao@gmail.com>
The reference must be released when device_register(&vm_cmdline_parent)
failed. Add the corresponding 'put_device()' in the error handling path.
Signed-off-by: chengkaitao <pilgrimtao@gmail.com>
---
drivers/virtio/virtio_mmio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 56128b9c46eb..1dd396d4bebb 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -688,6 +688,7 @@ static int vm_cmdline_set(const char *device,
if (!vm_cmdline_parent_registered) {
err = device_register(&vm_cmdline_parent);
if (err) {
+ put_device(&vm_cmdline_parent);
pr_err("Failed to register parent device!\n");
return err;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
2022-06-02 0:55 [PATCH] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed chengkaitao
@ 2022-06-08 8:11 ` Jason Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2022-06-08 8:11 UTC (permalink / raw)
To: chengkaitao; +Cc: smcdef, virtualization, linux-kernel, mst
On Thu, Jun 2, 2022 at 9:12 AM chengkaitao <pilgrimtao@gmail.com> wrote:
>
> From: chengkaitao <pilgrimtao@gmail.com>
>
> The reference must be released when device_register(&vm_cmdline_parent)
> failed. Add the corresponding 'put_device()' in the error handling path.
>
> Signed-off-by: chengkaitao <pilgrimtao@gmail.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/virtio/virtio_mmio.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 56128b9c46eb..1dd396d4bebb 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -688,6 +688,7 @@ static int vm_cmdline_set(const char *device,
> if (!vm_cmdline_parent_registered) {
> err = device_register(&vm_cmdline_parent);
> if (err) {
> + put_device(&vm_cmdline_parent);
> pr_err("Failed to register parent device!\n");
> return err;
> }
> --
> 2.14.1
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
@ 2022-06-08 8:11 ` Jason Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2022-06-08 8:11 UTC (permalink / raw)
To: chengkaitao; +Cc: mst, virtualization, linux-kernel, smcdef
On Thu, Jun 2, 2022 at 9:12 AM chengkaitao <pilgrimtao@gmail.com> wrote:
>
> From: chengkaitao <pilgrimtao@gmail.com>
>
> The reference must be released when device_register(&vm_cmdline_parent)
> failed. Add the corresponding 'put_device()' in the error handling path.
>
> Signed-off-by: chengkaitao <pilgrimtao@gmail.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/virtio/virtio_mmio.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 56128b9c46eb..1dd396d4bebb 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -688,6 +688,7 @@ static int vm_cmdline_set(const char *device,
> if (!vm_cmdline_parent_registered) {
> err = device_register(&vm_cmdline_parent);
> if (err) {
> + put_device(&vm_cmdline_parent);
> pr_err("Failed to register parent device!\n");
> return err;
> }
> --
> 2.14.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-08 8:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 0:55 [PATCH] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed chengkaitao
2022-06-08 8:11 ` Jason Wang
2022-06-08 8:11 ` 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.