[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_OuicNuLOhOXhotQ1gKx4MfzRpByMk5bdFut-smCwvpEQ@mail.gmail.com>
Date: Tue, 12 Aug 2025 12:46:11 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Qianfeng Rong <rongqianfeng@...o.com>
Cc: Austin Zheng <austin.zheng@....com>, Jun Lei <jun.lei@....com>,
Harry Wentland <harry.wentland@....com>, Leo Li <sunpeng.li@....com>,
Rodrigo Siqueira <siqueira@...lia.com>, Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Dillon Varone <dillon.varone@....com>, Alvin Lee <alvin.lee2@....com>,
Aurabindo Pillai <aurabindo.pillai@....com>, amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/amd/display: Use boolean context for pointer null checks
Applied. Thanks!
On Tue, Aug 12, 2025 at 4:38 AM Qianfeng Rong <rongqianfeng@...o.com> wrote:
>
> Replace "out == 0" with "!out" for pointer comparison to improve code
> readability and conform to coding style.
>
> Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
> ---
> .../amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_factory.c | 2 +-
> .../amd/display/dc/dml2/dml21/src/dml2_dpmm/dml2_dpmm_factory.c | 2 +-
> .../amd/display/dc/dml2/dml21/src/dml2_mcg/dml2_mcg_factory.c | 2 +-
> .../amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_factory.c | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_factory.c b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_factory.c
> index 28394de02885..640087e862f8 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_factory.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_factory.c
> @@ -10,7 +10,7 @@ bool dml2_core_create(enum dml2_project_id project_id, struct dml2_core_instance
> {
> bool result = false;
>
> - if (out == 0)
> + if (!out)
> return false;
>
> memset(out, 0, sizeof(struct dml2_core_instance));
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_dpmm/dml2_dpmm_factory.c b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_dpmm/dml2_dpmm_factory.c
> index 3861bc6c9621..dfd01440737d 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_dpmm/dml2_dpmm_factory.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_dpmm/dml2_dpmm_factory.c
> @@ -20,7 +20,7 @@ bool dml2_dpmm_create(enum dml2_project_id project_id, struct dml2_dpmm_instance
> {
> bool result = false;
>
> - if (out == 0)
> + if (!out)
> return false;
>
> memset(out, 0, sizeof(struct dml2_dpmm_instance));
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_mcg/dml2_mcg_factory.c b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_mcg/dml2_mcg_factory.c
> index cd3fbc0591d8..c60b8fe90819 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_mcg/dml2_mcg_factory.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_mcg/dml2_mcg_factory.c
> @@ -15,7 +15,7 @@ bool dml2_mcg_create(enum dml2_project_id project_id, struct dml2_mcg_instance *
> {
> bool result = false;
>
> - if (out == 0)
> + if (!out)
> return false;
>
> memset(out, 0, sizeof(struct dml2_mcg_instance));
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_factory.c b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_factory.c
> index 7ed0242a4b33..55d2464365d0 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_factory.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_factory.c
> @@ -26,7 +26,7 @@ bool dml2_pmo_create(enum dml2_project_id project_id, struct dml2_pmo_instance *
> {
> bool result = false;
>
> - if (out == 0)
> + if (!out)
> return false;
>
> memset(out, 0, sizeof(struct dml2_pmo_instance));
> --
> 2.34.1
>
Powered by blists - more mailing lists