Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: typec: intel_pmc_mux: Don't leak the ACPI device reference count

When acpi_dev_get_memory_resources() fails, the reference count is
left bumped. Drop it as it's done in the other error paths.

Fixes: 43d596e32276 ("usb: typec: intel_pmc_mux: Check the port status before connect")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230102202933.15968-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
c3194949 ccb0beb4

+3 -1
+3 -1
drivers/usb/typec/mux/intel_pmc_mux.c
··· 614 614 615 615 INIT_LIST_HEAD(&resource_list); 616 616 ret = acpi_dev_get_memory_resources(adev, &resource_list); 617 - if (ret < 0) 617 + if (ret < 0) { 618 + acpi_dev_put(adev); 618 619 return ret; 620 + } 619 621 620 622 rentry = list_first_entry_or_null(&resource_list, struct resource_entry, node); 621 623 if (rentry)