]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Warn about aux msg buffer vs. size mismatch
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 28 Jul 2016 14:55:04 +0000 (17:55 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 2 Aug 2016 13:25:10 +0000 (16:25 +0300)
If we have have a buffer, we should also have a size, and vice versa.
Let's check it both ways instead of just one.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1469717704-13020-1-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_dp.c

index 21b04c3eda41bf6f7685b6080b9e4a5228f3a116..001f74fc0ce55346e1cfd51fc6e4d5c16db559e6 100644 (file)
@@ -1041,10 +1041,10 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
                if (WARN_ON(txsize > 20))
                        return -E2BIG;
 
+               WARN_ON(!msg->buffer != !msg->size);
+
                if (msg->buffer)
                        memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size);
-               else
-                       WARN_ON(msg->size);
 
                ret = intel_dp_aux_ch(intel_dp, txbuf, txsize, rxbuf, rxsize);
                if (ret > 0) {