]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm: imx: fix compiler warning with gcc-12
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 8 Jun 2022 23:59:29 +0000 (16:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 9 Jun 2022 16:39:44 +0000 (09:39 -0700)
Gcc-12 correctly warned about this code using a non-NULL pointer as a
truth value:

  drivers/gpu/drm/imx/ipuv3-crtc.c: In function ‘ipu_crtc_disable_planes’:
  drivers/gpu/drm/imx/ipuv3-crtc.c:72:21: error: the comparison will always evaluate as ‘true’ for the address of ‘plane’ will never be NULL [-Werror=address]
     72 |                 if (&ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
        |                     ^

due to the extraneous '&' address-of operator.

Philipp Zabel points out that The mistake had no adverse effect since
the following condition doesn't actually dereference the NULL pointer,
but the intent of the code was obviously to check for it, not to take
the address of the member.

Fixes: 6e1d2e82a7b8 ("drm/imx: add deferred plane disabling")
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/gpu/drm/imx/ipuv3-crtc.c

index 9c8829f945b23a293dde34854b4de08f0ed47400..f7863d6dea80484497ef091efacd39d320b3f817 100644 (file)
@@ -69,7 +69,7 @@ static void ipu_crtc_disable_planes(struct ipu_crtc *ipu_crtc,
        drm_atomic_crtc_state_for_each_plane(plane, old_crtc_state) {
                if (plane == &ipu_crtc->plane[0]->base)
                        disable_full = true;
-               if (&ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
+               if (ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
                        disable_partial = true;
        }