i2c: acpi: fix resource leak in reconfiguration device addition
authorJamie Iles <quic_jiles@quicinc.com>
Wed, 22 Sep 2021 16:57:18 +0000 (17:57 +0100)
committerWolfram Sang <wsa@kernel.org>
Sat, 2 Oct 2021 06:38:43 +0000 (08:38 +0200)
commit6558b646ce1c2a872fe1c2c7cb116f05a2c1950f
treea05a27004e04118d201ab11c3c411715c2e83412
parent5816b3e6577eaa676ceb00a848f0fd65fe2adc29
i2c: acpi: fix resource leak in reconfiguration device addition

acpi_i2c_find_adapter_by_handle() calls bus_find_device() which takes a
reference on the adapter which is never released which will result in a
reference count leak and render the adapter unremovable.  Make sure to
put the adapter after creating the client in the same manner that we do
for OF.

Fixes: 525e6fabeae2 ("i2c / ACPI: add support for ACPI reconfigure notifications")
Signed-off-by: Jamie Iles <quic_jiles@quicinc.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
[wsa: fixed title]
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/i2c-core-acpi.c