virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
authorchengkaitao <pilgrimtao@gmail.com>
Thu, 2 Jun 2022 00:55:42 +0000 (08:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2022 09:46:43 +0000 (11:46 +0200)
commiteef6d16cce8299491e42b820839534b1cd3bedfc
tree67f587d6b4dac4106dc1954d26468f6e149aa26c
parentc2f6262132cd6e5eb04e64f1dfbaab611ee5df73
virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed

[ Upstream commit a58a7f97ba11391d2d0d408e0b24f38d86ae748e ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/virtio/virtio_mmio.c