[PATCH] i2c: Not all adapters have a parent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
Cc: Wolfram Sang <wsa@xxxxxxxxxxxxx>
Cc: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>
---
 drivers/i2c/i2c-core.c |    3 +++
 1 file changed, 3 insertions(+)

--- linux-3.12-rc4.orig/drivers/i2c/i2c-core.c	2013-09-24 00:41:09.000000000 +0200
+++ linux-3.12-rc4/drivers/i2c/i2c-core.c	2013-10-10 07:46:12.244886047 +0200
@@ -1134,6 +1134,9 @@ static void acpi_i2c_register_devices(st
 	acpi_handle handle;
 	acpi_status status;
 
+	if (!adap->dev.parent)
+		return;
+
 	handle = ACPI_HANDLE(adap->dev.parent);
 	if (!handle)
 		return;


-- 
Jean Delvare
Suse L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux