diff options
author | Jean Delvare <jdelvare@suse.de> | 2013-10-10 08:04:06 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2013-10-10 10:22:31 +0200 |
commit | 47b6e477ed4ecacddd1f82d04d686026e08dc3db (patch) | |
tree | f9e03f3e28a24d9c4197d5483dd22585de74c583 /drivers/i2c | |
parent | i2c: i2c-stu300: replace platform_driver_probe to support deferred probing (diff) | |
download | linux-47b6e477ed4ecacddd1f82d04d686026e08dc3db.tar.xz linux-47b6e477ed4ecacddd1f82d04d686026e08dc3db.zip |
i2c: Not all adapters have a parent
The code in acpi_i2c_register_devices() assumes that all i2c adapters
have a parent. This is not necessarily the case, for example the
i2c-stub driver instantiate a virtual i2c adapter without a parent.
Check for this to avoid a NULL pointer deference.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 29d3f045a2bf..3be58f89ac77 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1134,6 +1134,9 @@ static void acpi_i2c_register_devices(struct i2c_adapter *adap) acpi_handle handle; acpi_status status; + if (!adap->dev.parent) + return; + handle = ACPI_HANDLE(adap->dev.parent); if (!handle) return; |