linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: Not all adapters have a parent
@ 2013-10-10  6:04 Jean Delvare
       [not found] ` <20131010080406.3e0fd78e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jean Delvare @ 2013-10-10  6:04 UTC (permalink / raw)
  To: Linux I2C; +Cc: Wolfram Sang, Mika Westerberg, Rafael J. Wysocki

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-l3A5Bk7waGM@public.gmane.org>
Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-10  7:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-10  6:04 [PATCH] i2c: Not all adapters have a parent Jean Delvare
     [not found] ` <20131010080406.3e0fd78e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2013-10-10  6:15   ` Mika Westerberg
2013-10-10  7:35   ` Wolfram Sang
2013-10-10  7:45     ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).