2023-12-01 09:33:40

by Jiapeng Chong

[permalink] [raw]
Subject: [PATCH] drm/amd/display: Fix warning comparing pointer to 0

Avoid pointer type value compared with 0 to make code clear.

./drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c:532:62-63: WARNING comparing pointer to 0.

Reported-by: Abaci Robot <[email protected]>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7672
Signed-off-by: Jiapeng Chong <[email protected]>
---
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c b/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
index 38360adc53d9..7d13d2e1bda8 100644
--- a/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
+++ b/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
@@ -529,7 +529,7 @@ enum dmub_status dmub_srv_calc_mem_info(struct dmub_srv *dmub,
out->fb[i].cpu_addr = cpu_base + reg->base;
out->fb[i].gpu_addr = gpu_base + reg->base;

- if (i == DMUB_WINDOW_4_MAILBOX && params->cpu_inbox_addr != 0) {
+ if (i == DMUB_WINDOW_4_MAILBOX && params->cpu_inbox_addr) {
out->fb[i].cpu_addr = (uint8_t *)params->cpu_inbox_addr + reg->base;
out->fb[i].gpu_addr = params->gpu_inbox_addr + reg->base;
}
--
2.20.1.7.g153144c