Skip to content

Commit ff9c674

Browse files
nathanchancelucasdemarchi
authored andcommitted
drm/xe: Fix total initialization in xe_ggtt_print_holes()
Clang warns (or errors with CONFIG_DRM_WERROR or CONFIG_WERROR): drivers/gpu/drm/xe/xe_ggtt.c:810:3: error: variable 'total' is uninitialized when used here [-Werror,-Wuninitialized] 810 | total += hole_size; | ^~~~~ drivers/gpu/drm/xe/xe_ggtt.c:798:11: note: initialize the variable 'total' to silence this warning 798 | u64 total; | ^ | = 0 1 error generated. Move the zero initialization of total from xe_gt_sriov_pf_config_print_available_ggtt() to xe_ggtt_print_holes() to resolve the warning. Fixes: 1363672 ("drm/xe: Introduce xe_ggtt_print_holes") Signed-off-by: Nathan Chancellor <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20240823-drm-xe-fix-total-in-xe_ggtt_print_holes-v1-1-12b02d079327@kernel.org Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 66a0f6b commit ff9c674

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/gpu/drm/xe/xe_ggtt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ u64 xe_ggtt_print_holes(struct xe_ggtt *ggtt, u64 alignment, struct drm_printer
795795
const struct drm_mm_node *entry;
796796
u64 hole_min_start = xe_wopcm_size(tile_to_xe(ggtt->tile));
797797
u64 hole_start, hole_end, hole_size;
798-
u64 total;
798+
u64 total = 0;
799799
char buf[10];
800800

801801
mutex_lock(&ggtt->lock);

drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2110,7 +2110,7 @@ int xe_gt_sriov_pf_config_print_available_ggtt(struct xe_gt *gt, struct drm_prin
21102110
{
21112111
struct xe_ggtt *ggtt = gt_to_tile(gt)->mem.ggtt;
21122112
u64 alignment = pf_get_ggtt_alignment(gt);
2113-
u64 spare, avail, total = 0;
2113+
u64 spare, avail, total;
21142114
char buf[10];
21152115

21162116
xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));

0 commit comments

Comments
 (0)