[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250605120222.803462-1-l1138897701@163.com>
Date: Thu, 5 Jun 2025 20:02:22 +0800
From: luoqing <l1138897701@....com>
To: harry.wentland@....com
Cc: sunpeng.li@....com,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
airlied@...il.com,
simona@...ll.ch,
amd-gfx@...ts.freedesktop.org,
luoqing@...inos.cn
Subject: [PATCH 2/2] drm/amd/display: ZERO_OR_NULL_PTR Macro overdetection
From: luoqing <luoqing@...inos.cn>
sizeof(xx) these variable values' return values cannot be 0.
For memory allocation requests of non-zero length,
there is no need to check other return values;
it is sufficient to only verify that it is not null.
Signed-off-by: luoqing <luoqing@...inos.cn>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +-
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
index e8bdd7f0c460..518383425c80 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
@@ -230,7 +230,7 @@ struct idle_workqueue *idle_create_workqueue(struct amdgpu_device *adev)
struct idle_workqueue *idle_work;
idle_work = kzalloc(sizeof(*idle_work), GFP_KERNEL);
- if (ZERO_OR_NULL_PTR(idle_work))
+ if (!idle_work)
return NULL;
idle_work->dm = &adev->dm;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
index c16962256514..1cf2cf7a9a47 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
@@ -735,7 +735,7 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev,
int i = 0;
hdcp_work = kcalloc(max_caps, sizeof(*hdcp_work), GFP_KERNEL);
- if (ZERO_OR_NULL_PTR(hdcp_work))
+ if (!hdcp_work)
return NULL;
hdcp_work->srm = kcalloc(PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE,
--
2.25.1
Powered by blists - more mailing lists