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)
commit7aefd8b53815274f3ef398d370a3c9b27dd9f00c
treebbad3bc7364c3bdfcdb6531baf73421d6c4519dd
parent6bfb56e93bcef41859c2d5ab234ffd80b691be35
drm: imx: fix compiler warning with gcc-12

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: eb8c88808c83 ("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