[PATCH] drm/amd/display: Use boolean context for pointer null checks
Alex Deucher
alexdeucher at gmail.com
Tue Aug 12 16:46:11 UTC 2025
Applied. Thanks!
On Tue, Aug 12, 2025 at 4:38 AM Qianfeng Rong <rongqianfeng at vivo.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 at vivo.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
>
More information about the dri-devel
mailing list