[PATCH 2/2] drm/amd/display: ZERO_OR_NULL_PTR Macro overdetection
luoqing
l1138897701 at 163.com
Thu Jun 5 12:02:22 UTC 2025
From: luoqing <luoqing at kylinos.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 at kylinos.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
More information about the dri-devel
mailing list