]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: fix uninitialized variable warning for amdgpu_xgmi
authorTim Huang <Tim.Huang@amd.com>
Mon, 6 May 2024 05:48:57 +0000 (13:48 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 8 May 2024 19:17:05 +0000 (15:17 -0400)
Clear warning that using uninitialized variable current_node.

Signed-off-by: Tim Huang <Tim.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c

index dd2ec48cf5c2670bb026c72a4b11546bf48e9b9b..4a14f9c1bfe892ae8cec5e8eb2e6a3ededd729ee 100644 (file)
@@ -434,6 +434,9 @@ static ssize_t amdgpu_xgmi_show_connected_port_num(struct device *dev,
                }
        }
 
+       if (i == top->num_nodes)
+               return -EINVAL;
+
        for (i = 0; i < top->num_nodes; i++) {
                for (j = 0; j < top->nodes[i].num_links; j++)
                        /* node id in sysfs starts from 1 rather than 0 so +1 here */