summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index b696ac7e6d86..ccfbbab82a15 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -371,10 +371,15 @@ acpi_i2c_space_handler(u32 function, acpi_physical_address command,
static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
{
- acpi_handle handle = ACPI_HANDLE(adapter->dev.parent);
+ acpi_handle handle;
struct acpi_i2c_handler_data *data;
acpi_status status;
+ if (!adapter->dev.parent)
+ return -ENODEV;
+
+ handle = ACPI_HANDLE(adapter->dev.parent);
+
if (!handle)
return -ENODEV;
@@ -407,10 +412,15 @@ static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
static void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter)
{
- acpi_handle handle = ACPI_HANDLE(adapter->dev.parent);
+ acpi_handle handle;
struct acpi_i2c_handler_data *data;
acpi_status status;
+ if (!adapter->dev.parent)
+ return;
+
+ handle = ACPI_HANDLE(adapter->dev.parent);
+
if (!handle)
return;