]> 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)
commitc82fda8cad998a6a6d054414b1deeff98af18906
treebbad3bc7364c3bdfcdb6531baf73421d6c4519dd
parenta923b186816d235f613c5eb2805fe717fb9752bb
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: 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