2020-04-20 12:53:17

by 赵军奎

[permalink] [raw]
Subject: [PATCH V2] amdgpu, fix unnessary check "info" NULL branch

kvfree ensure that the null pointer will do nothing.
If addr is NULL, first is_vmalloc_addr will not enter,
and kfree function just return when addr is NULL. There
will be no risk here.

Signed-off-by: Bernard Zhao <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index af91627b..814bd5d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -98,8 +98,7 @@ static int amdgpu_cs_bo_handles_chunk(struct amdgpu_cs_parser *p,
return 0;

error_free:
- if (info)
- kvfree(info);
+ kvfree(info);

return r;
}
--
2.7.4