diff options
| author | Dan Carpenter <[email protected]> | 2020-05-20 15:25:56 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2020-05-21 16:48:43 +0000 |
| commit | 62cc895c02fb9d1170f02dc1dfa3c2135ebe100b (patch) | |
| tree | 3d2cde0070633b331233887e16bcdb2383fccc60 /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | |
| parent | drm/amdgpu/smu10: Replace one-element array and use struct_size() helper (diff) | |
| download | kernel-62cc895c02fb9d1170f02dc1dfa3c2135ebe100b.tar.gz kernel-62cc895c02fb9d1170f02dc1dfa3c2135ebe100b.zip | |
drm/amdgpu: off by one in amdgpu_device_attr_create_groups() error handling
This loop in the error handling code should start a "i - 1" and end at
"i == 0". Currently it starts a "i" and ends at "i == 1". The result
is that it removes one attribute that wasn't created yet, and leaks the
zeroeth attribute.
Fixes: 4e01847c38f7 ("drm/amdgpu: optimize amdgpu device attribute code")
Acked-by: Michael J. Ruhl <[email protected]>
Reviewed-by: Christian König <[email protected]>
Reviewed-by: Kevin Wang <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index bc7de2f62d12..17bc7f530898 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c @@ -1837,9 +1837,8 @@ static int amdgpu_device_attr_create_groups(struct amdgpu_device *adev, return 0; failed: - for (; i > 0; i--) { + while (i--) amdgpu_device_attr_remove(adev, &attrs[i]); - } return ret; } |
