From: Tim Huang Date: Mon, 6 May 2024 05:48:57 +0000 (+0800) Subject: drm/amdgpu: fix uninitialized variable warning for amdgpu_xgmi X-Git-Tag: v6.11-rc1~141^2~25^2~309 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8f184f8e7a07fddc33ee4e6a38b717c770c3aedd;p=thirdparty%2Fkernel%2Flinux.git drm/amdgpu: fix uninitialized variable warning for amdgpu_xgmi Clear warning that using uninitialized variable current_node. Signed-off-by: Tim Huang Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c index dd2ec48cf5c26..4a14f9c1bfe89 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c @@ -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 */