[PATCH] drm/xe : Fix mixed enum type warning
Jani Nikula
jani.nikula at linux.intel.com
Thu Mar 21 12:51:41 UTC 2024
On Thu, 21 Mar 2024, Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com> wrote:
> The issue arises from comparing an unsigned integer with a macro-defined
> value. To address this, cast the macro-defined value to the same data
> type as the other operand.
I don't think the explanations are convincing, as this has nothing to do
with enums. And in general just adding casts to ignore warnings is not
the way to go.
BR,
Jani.
>
> Cc: Zhanjun Dong <zhanjun.dong at intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> ---
> Coverity Reports "Parse warning (PW.MIXED_ENUM_TYPE)
> 1. mixed_enum_type enumerated type mixed with another type"
>
> drivers/gpu/drm/xe/xe_gt_mcr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.c b/drivers/gpu/drm/xe/xe_gt_mcr.c
> index 866bbd26ba3f..027cb60c60c1 100644
> --- a/drivers/gpu/drm/xe/xe_gt_mcr.c
> +++ b/drivers/gpu/drm/xe/xe_gt_mcr.c
> @@ -311,7 +311,7 @@ void xe_gt_mcr_get_dss_steering(struct xe_gt *gt, unsigned int dss, u16 *group,
> {
> int dss_per_grp = dss_per_group(gt);
>
> - xe_gt_assert(gt, dss < XE_MAX_DSS_FUSE_BITS);
> + xe_gt_assert(gt, dss < (unsigned int)XE_MAX_DSS_FUSE_BITS);
>
> *group = dss / dss_per_grp;
> *instance = dss % dss_per_grp;
--
Jani Nikula, Intel
More information about the Intel-xe
mailing list