Commit 9dda7374 authored by Wolfram Sang's avatar Wolfram Sang Committed by Greg Kroah-Hartman

i2c: acpi: put device when verifying client fails

commit 8daee952 upstream.

i2c_verify_client() can fail, so we need to put the device when that
happens.

Fixes: 525e6fab ("i2c / ACPI: add support for ACPI reconfigure notifications")
Reported-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7967fef2
...@@ -352,10 +352,18 @@ static struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle) ...@@ -352,10 +352,18 @@ static struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev) static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev)
{ {
struct device *dev; struct device *dev;
struct i2c_client *client;
dev = bus_find_device(&i2c_bus_type, NULL, adev, dev = bus_find_device(&i2c_bus_type, NULL, adev,
i2c_acpi_find_match_device); i2c_acpi_find_match_device);
return dev ? i2c_verify_client(dev) : NULL; if (!dev)
return NULL;
client = i2c_verify_client(dev);
if (!client)
put_device(dev);
return client;
} }
static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value, static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment