Skip to content

Commit

Permalink
usb: typec: intel_pmc_mux: Don't leak the ACPI device reference count
Browse files Browse the repository at this point in the history
[ Upstream commit c319494 ]

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: 43d596e ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
andy-shev authored and gregkh committed Mar 10, 2023
1 parent 1a31f1c commit c13e1a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/typec/mux/intel_pmc_mux.c
Expand Up @@ -614,8 +614,10 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc)

INIT_LIST_HEAD(&resource_list);
ret = acpi_dev_get_memory_resources(adev, &resource_list);
if (ret < 0)
if (ret < 0) {
acpi_dev_put(adev);
return ret;
}

rentry = list_first_entry_or_null(&resource_list, struct resource_entry, node);
if (rentry)
Expand Down

0 comments on commit c13e1a9

Please sign in to comment.