diff options
author | chengkaitao <pilgrimtao@gmail.com> | 2022-06-02 08:55:42 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-06-08 08:56:03 -0400 |
commit | a58a7f97ba11391d2d0d408e0b24f38d86ae748e (patch) | |
tree | 350a294cc0bb86c64b5f341e3d8bbf78443f3ccc | |
parent | 2f72b2262d317093596c72bd5b27b9880be7611e (diff) | |
download | linux-stable-a58a7f97ba11391d2d0d408e0b24f38d86ae748e.tar.gz linux-stable-a58a7f97ba11391d2d0d408e0b24f38d86ae748e.tar.bz2 linux-stable-a58a7f97ba11391d2d0d408e0b24f38d86ae748e.zip |
virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
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>
Message-Id: <20220602005542.16489-1-chengkaitao@didiglobal.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
-rw-r--r-- | drivers/virtio/virtio_mmio.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index f9a36bc7ac27..5ce79bf9f92b 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -701,6 +701,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; } |