mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 03:27:03 +02:00
UPSTREAM: 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>
(cherry picked from commit a58a7f97ba)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6ccf7cba3458dd3402ce0bb39d2b110a599ad7ee
This commit is contained in:
parent
5571a91668
commit
2e977b72c0
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user