diff options
author | Michał Winiarski <[email protected]> | 2023-05-23 15:50:19 +0200 |
---|---|---|
committer | Rodrigo Vivi <[email protected]> | 2023-12-21 11:34:42 -0500 |
commit | 35cbfe561912874a1f0d4b2ceb5fe890f0f58e46 (patch) | |
tree | f1173635dc2888c31bc1dfd6d136ac2a4ec113d8 | |
parent | 1e80d0c3c44806e6ff885102a937ea838a01f560 (diff) |
drm/xe: Fix uninitialized variables
Using uninitialized variables leads to undefined behavior.
Moreover, it causes the compiler to complain with:
../drivers/gpu/drm/xe/xe_vm.c:3265:40: error: variable 'vma' is uninitialized when used here [-Werror,-Wuninitialized]
../drivers/gpu/drm/xe/xe_rtp.c:118:36: error: variable 'i' is uninitialized when used here [-Werror,-Wuninitialized]
../drivers/gpu/drm/xe/xe_mocs.c:449:3: error: variable 'flags' is uninitialized when used here [-Werror,-Wuninitialized]
Signed-off-by: Michał Winiarski <[email protected]>
Reviewed-by: Matt Roper <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Rodrigo Vivi <[email protected]>
-rw-r--r-- | drivers/gpu/drm/xe/xe_mocs.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/xe/xe_rtp.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/xe/xe_vm.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/xe/xe_mocs.c b/drivers/gpu/drm/xe/xe_mocs.c index 86277ecb749b..ccc852500eda 100644 --- a/drivers/gpu/drm/xe/xe_mocs.c +++ b/drivers/gpu/drm/xe/xe_mocs.c @@ -373,7 +373,7 @@ static const struct xe_mocs_entry mtl_mocs_desc[] = { static unsigned int get_mocs_settings(struct xe_device *xe, struct xe_mocs_info *info) { - unsigned int flags; + unsigned int flags = 0; memset(info, 0, sizeof(struct xe_mocs_info)); diff --git a/drivers/gpu/drm/xe/xe_rtp.c b/drivers/gpu/drm/xe/xe_rtp.c index 956bd39fe1a0..8aae34df3801 100644 --- a/drivers/gpu/drm/xe/xe_rtp.c +++ b/drivers/gpu/drm/xe/xe_rtp.c @@ -136,7 +136,7 @@ static bool rtp_process_one_sr(const struct xe_rtp_entry_sr *entry, if (!rule_matches(xe, gt, hwe, entry->rules, entry->n_rules)) return false; - for (action = &entry->actions[0]; i < entry->n_actions; action++, i++) { + for (i = 0, action = &entry->actions[0]; i < entry->n_actions; action++, i++) { if ((entry->flags & XE_RTP_ENTRY_FLAG_FOREACH_ENGINE) || (action->flags & XE_RTP_ACTION_FLAG_ENGINE_BASE)) mmio_base = hwe->mmio_base; diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index eb2209d2d1cd..b8a0fe24d1d0 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -3297,7 +3297,7 @@ destroy_vmas: if (!vmas[i]) break; - list_for_each_entry_safe(vma, next, &vma->unbind_link, + list_for_each_entry_safe(vma, next, &vmas[i]->unbind_link, unbind_link) { list_del_init(&vma->unbind_link); if (!vma->destroyed) { |