]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amd/display: Remove pointless NULL checks in dmub_psr_copy_settings
authorNathan Chancellor <natechancellor@gmail.com>
Mon, 2 Mar 2020 22:42:17 +0000 (15:42 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 5 Mar 2020 06:03:45 +0000 (01:03 -0500)
commitd1aa4356d3758eec62d35cc7433696b76cadb040
treed7c8d63ca5aafa3813cb06f656b6baa3042134f7
parenta2e048590ab4eb81429d88006de6b95c42ee4087
drm/amd/display: Remove pointless NULL checks in dmub_psr_copy_settings

Clang warns:

drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_psr.c:147:31: warning:
address of 'pipe_ctx->plane_res' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (!pipe_ctx || !&pipe_ctx->plane_res || !&pipe_ctx->stream_res)
                         ~ ~~~~~~~~~~^~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_psr.c:147:56: warning:
address of 'pipe_ctx->stream_res' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (!pipe_ctx || !&pipe_ctx->plane_res || !&pipe_ctx->stream_res)
                                                  ~ ~~~~~~~~~~^~~~~~~~~~
2 warnings generated.

As long as pipe_ctx is not NULL, the address of members in this struct
cannot be NULL, which means these checks will always evaluate to false.

Fixes: 8a94f0cb4996 ("drm/amd/display: Driverside changes to support PSR in DMCUB")
Link: https://github.com/ClangBuiltLinux/linux/issues/915
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c