Skip to content

Commit 8daee95

Browse files
Wolfram SangWolfram Sang
authored andcommitted
i2c: acpi: put device when verifying client fails
i2c_verify_client() can fail, so we need to put the device when that happens. Fixes: 525e6fa ("i2c / ACPI: add support for ACPI reconfigure notifications") Reported-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 3747cd2 commit 8daee95

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/i2c/i2c-core-acpi.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,17 @@ EXPORT_SYMBOL_GPL(i2c_acpi_find_adapter_by_handle);
394394
static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev)
395395
{
396396
struct device *dev;
397+
struct i2c_client *client;
397398

398399
dev = bus_find_device_by_acpi_dev(&i2c_bus_type, adev);
399-
return dev ? i2c_verify_client(dev) : NULL;
400+
if (!dev)
401+
return NULL;
402+
403+
client = i2c_verify_client(dev);
404+
if (!client)
405+
put_device(dev);
406+
407+
return client;
400408
}
401409

402410
static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,

0 commit comments

Comments
 (0)