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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to