Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Nov 2019 20:40:56 +0000 (UTC)
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354292 - head/sys/dev/ichiic
Message-ID:  <201911032040.xA3Keu1N053306@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wulf
Date: Sun Nov  3 20:40:55 2019
New Revision: 354292
URL: https://svnweb.freebsd.org/changeset/base/354292

Log:
  [ig4] Handle controller startup errors
  
  Fail the attach on controller startup errors.  For some reason the
  dell xps 13 says there's I2C controller, but the controller appears
  to be permanente disabled and will refuse to enable.
  
  Obtained from:	DragonflyBSD (509820b)

Modified:
  head/sys/dev/ichiic/ig4_iic.c

Modified: head/sys/dev/ichiic/ig4_iic.c
==============================================================================
--- head/sys/dev/ichiic/ig4_iic.c	Sun Nov  3 20:39:46 2019	(r354291)
+++ head/sys/dev/ichiic/ig4_iic.c	Sun Nov  3 20:40:55 2019	(r354292)
@@ -629,10 +629,18 @@ ig4iic_attach(ig4iic_softc_t *sc)
 #endif
 
 	mtx_lock(&sc->io_lock);
-	if (set_controller(sc, 0))
+	if (set_controller(sc, 0)) {
 		device_printf(sc->dev, "controller error during attach-1\n");
-	if (set_controller(sc, IG4_I2C_ENABLE))
+		mtx_unlock(&sc->io_lock);
+		error = ENXIO;
+		goto done;
+	}
+	if (set_controller(sc, IG4_I2C_ENABLE)) {
 		device_printf(sc->dev, "controller error during attach-2\n");
+		mtx_unlock(&sc->io_lock);
+		error = ENXIO;
+		goto done;
+	}
 	mtx_unlock(&sc->io_lock);
 	error = bus_setup_intr(sc->dev, sc->intr_res, INTR_TYPE_MISC | INTR_MPSAFE,
 			       NULL, ig4iic_intr, sc, &sc->intr_handle);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911032040.xA3Keu1N053306>