From fbeaca1202d1a1e987a6f7ed0777086ed45cb46f Mon Sep 17 00:00:00 2001 From: "Assadian, Navid" Date: Mon, 21 Jul 2025 10:45:42 -0400 Subject: [PATCH] amd/vpelib: Add necessary pointer casting Add necessary pointer casting to prevent unexpected behavior Acked-by: Chuanyu Tseng Signed-off-by: Navid Assadian Part-of: --- src/amd/vpelib/src/core/color.c | 16 ++++++++++------ src/amd/vpelib/src/core/inc/mpc.h | 1 + src/amd/vpelib/src/core/inc/opp.h | 1 + src/amd/vpelib/src/utils/inc/vector.h | 1 - 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/amd/vpelib/src/core/color.c b/src/amd/vpelib/src/core/color.c index c333b6ef249..d3ec6c71b11 100644 --- a/src/amd/vpelib/src/core/color.c +++ b/src/amd/vpelib/src/core/color.c @@ -177,14 +177,15 @@ static enum vpe_status vpe_allocate_cm_memory( } if (!stream_ctx->gamut_remap) { - stream_ctx->gamut_remap = vpe_zalloc(sizeof(struct colorspace_transform)); + stream_ctx->gamut_remap = + (struct colorspace_transform *)vpe_zalloc(sizeof(struct colorspace_transform)); if (!stream_ctx->gamut_remap) { vpe_log("err: out of memory for gamut_remap!"); return VPE_STATUS_NO_MEMORY; } } if (!stream_ctx->blend_tf) { - stream_ctx->blend_tf = vpe_zalloc(sizeof(struct transfer_func)); + stream_ctx->blend_tf = (struct transfer_func *)vpe_zalloc(sizeof(struct transfer_func)); if (!stream_ctx->blend_tf) { vpe_log("err: out of memory for blend tf!"); return VPE_STATUS_NO_MEMORY; @@ -789,7 +790,8 @@ enum vpe_status vpe_color_update_movable_cm( enum color_transfer_func tf, lut_in_tf; if (!stream_ctx->in_shaper_func) { - stream_ctx->in_shaper_func = vpe_zalloc(sizeof(struct transfer_func)); + stream_ctx->in_shaper_func = + (struct transfer_func *)vpe_zalloc(sizeof(struct transfer_func)); if (!stream_ctx->in_shaper_func) { vpe_log("err: out of memory for shaper tf!"); ret = VPE_STATUS_NO_MEMORY; @@ -798,7 +800,8 @@ enum vpe_status vpe_color_update_movable_cm( } if (!stream_ctx->blend_tf) { - stream_ctx->blend_tf = vpe_zalloc(sizeof(struct transfer_func)); + stream_ctx->blend_tf = + (struct transfer_func *)vpe_zalloc(sizeof(struct transfer_func)); if (!stream_ctx->blend_tf) { vpe_log("err: out of memory for blend/post1d tf!"); ret = VPE_STATUS_NO_MEMORY; @@ -807,7 +810,7 @@ enum vpe_status vpe_color_update_movable_cm( } if (!stream_ctx->lut3d_func) { - stream_ctx->lut3d_func = vpe_zalloc(sizeof(struct vpe_3dlut)); + stream_ctx->lut3d_func = (struct vpe_3dlut *)vpe_zalloc(sizeof(struct vpe_3dlut)); if (!stream_ctx->lut3d_func) { vpe_log("err: out of memory for 3d lut!"); ret = VPE_STATUS_NO_MEMORY; @@ -816,7 +819,8 @@ enum vpe_status vpe_color_update_movable_cm( } if (!output_ctx->gamut_remap) { - output_ctx->gamut_remap = vpe_zalloc(sizeof(struct colorspace_transform)); + output_ctx->gamut_remap = + (struct colorspace_transform *)vpe_zalloc(sizeof(struct colorspace_transform)); if (!output_ctx->gamut_remap) { vpe_log("err: out of memory for post blend gamut remap!"); ret = VPE_STATUS_NO_MEMORY; diff --git a/src/amd/vpelib/src/core/inc/mpc.h b/src/amd/vpelib/src/core/inc/mpc.h index 8d78af6b874..b852c59ad71 100644 --- a/src/amd/vpelib/src/core/inc/mpc.h +++ b/src/amd/vpelib/src/core/inc/mpc.h @@ -25,6 +25,7 @@ #pragma once #include "vpe_types.h" +#include "hw_shared.h" #ifdef __cplusplus extern "C" { diff --git a/src/amd/vpelib/src/core/inc/opp.h b/src/amd/vpelib/src/core/inc/opp.h index 2cc0bf862aa..69809db666d 100644 --- a/src/amd/vpelib/src/core/inc/opp.h +++ b/src/amd/vpelib/src/core/inc/opp.h @@ -24,6 +24,7 @@ #pragma once #include "vpe_types.h" +#include "color.h" #ifdef __cplusplus extern "C" { diff --git a/src/amd/vpelib/src/utils/inc/vector.h b/src/amd/vpelib/src/utils/inc/vector.h index 070b73af302..79135e87e4d 100644 --- a/src/amd/vpelib/src/utils/inc/vector.h +++ b/src/amd/vpelib/src/utils/inc/vector.h @@ -25,7 +25,6 @@ #pragma once #include "vpe_types.h" -#include "resource.h" #ifdef __cplusplus extern "C" {