]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit6859495231c4d55639a6dfe848c2fb0d32c5c76a
treebbad3bc7364c3bdfcdb6531baf73421d6c4519dd
parentbc8b88a12050caa9fe922259b74aa7d437c5937a
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: b21e566efdf7 ("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