i2c_acpi_find_adapter_by_handle() returns the i2c adapter with its
device reference incremented. The lookup callback only reads the bus
number and never drops the reference. Put it back once done.

Fixes: 8cbf89db2941 ("drm/i915/dsi: Parse the I2C element from the VBT MIPI 
sequence block (v3)")
Cc: [email protected]
Signed-off-by: Wentao Liang <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c 
b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
index fe12041e913c..2097c5d17cb7 100644
--- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
@@ -460,8 +460,10 @@ static int i2c_adapter_lookup(struct acpi_resource *ares, 
void *data)
                return 1;
 
        adapter = i2c_acpi_find_adapter_by_handle(adapter_handle);
-       if (adapter)
+       if (adapter) {
                intel_dsi->i2c_bus_num = adapter->nr;
+               put_device(&adapter->dev);
+       }
 
        return 1;
 }
-- 
2.34.1

Reply via email to