drm/amdgpu: fix compiler warning(v2)
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix compiler warning(v2)
warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
int write = !(gtt->userflags & AMDGPU_GEM_USERPTR_READONLY);
v2: put short variable declaration last
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -3
@@ -823,11 +823,10 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_device *bdev, {struct amdgpu_device *adev =amdgpu_ttm_adev (bdev);struct amdgpu_ttm_tt *gtt = (void *)ttm; -int r; -int write = !(gtt->userflags &AMDGPU_GEM_USERPTR_READONLY );enum dma_data_direction direction = write ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ; +int r;/* Allocate an SG array and squash pages into it */ r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0,
@@ -861,7 +860,6 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_device *bdev, {struct amdgpu_device *adev =amdgpu_ttm_adev (bdev);struct amdgpu_ttm_tt *gtt = (void *)ttm; -int write = !(gtt->userflags &AMDGPU_GEM_USERPTR_READONLY );enum dma_data_direction direction = write ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 30.03.21 um 15:24 schrieb Guchun Chen:
Quoted 6 lines
warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
int write = !(gtt->userflags &AMDGPU_GEM_USERPTR_READONLY);v2: put short variable declaration last
Signed-off-by Guchun Chen <[email protected]>
I still don't know why you get a compiler warning, but it certainly improves the coding style.
Quoted 22 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-2@@ -823,11 +823,10 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_device *bdev, {struct amdgpu_device *adev =amdgpu_ttm_adev (bdev);struct amdgpu_ttm_tt *gtt = (void *)ttm; -int r; -int write = !(gtt->userflags &AMDGPU_GEM_USERPTR_READONLY );enum dma_data_direction direction = write ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ; +int r;/* Allocate an SG array and squash pages into it */ r = sg_alloc_table_from_pages(ttm->sg, ttm->pages, ttm->num_pages, 0,
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static void amdgpu_ttm_tt_unpin_userptr(struct ttm_device *bdev, · line 865
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0
-1@@ -861,7 +860,6 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_device *bdev, {struct amdgpu_device *adev =amdgpu_ttm_adev (bdev);struct amdgpu_ttm_tt *gtt = (void *)ttm; -int write = !(gtt->userflags &AMDGPU_GEM_USERPTR_READONLY );enum dma_data_direction direction = write ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx