drm/i915: simplify gmbus xfer error checks
authorJani Nikula <jani.nikula@intel.com>
Tue, 1 Dec 2015 14:29:25 +0000 (16:29 +0200)
committerJani Nikula <jani.nikula@intel.com>
Wed, 2 Dec 2015 11:27:46 +0000 (13:27 +0200)
Shorter, easier to follow code with no functional changes. In all cases,
the return value ultimately comes from gmbus_wait_hw_status() anyway.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1448980166-23055-1-git-send-email-jani.nikula@intel.com
drivers/gpu/drm/i915/intel_i2c.c

index 1110c83953cfed5c4cc434338f017a6091ff866d..ccb522c176bd2fe3839ea5e7434a2d9f86229402 100644 (file)
@@ -505,17 +505,13 @@ retry:
                        ret = gmbus_xfer_write(dev_priv, &msgs[i]);
                }
 
+               if (!ret)
+                       ret = gmbus_wait_hw_status(dev_priv, GMBUS_HW_WAIT_PHASE,
+                                                  GMBUS_HW_WAIT_EN);
                if (ret == -ETIMEDOUT)
                        goto timeout;
-               if (ret == -ENXIO)
+               else if (ret)
                        goto clear_err;
-
-               ret = gmbus_wait_hw_status(dev_priv, GMBUS_HW_WAIT_PHASE,
-                                          GMBUS_HW_WAIT_EN);
-               if (ret == -ENXIO)
-                       goto clear_err;
-               if (ret)
-                       goto timeout;
        }
 
        /* Generate a STOP condition on the bus. Note that gmbus can't generata