Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1676849

RE: [gpu-drm-radeon] question about potential dead code in vce_v2_0_enable_mgcg()

From "Deucher, Alexander" <Alexander.Deucher@amd.com>
Newsgroups linux.kernel
Subject RE: [gpu-drm-radeon] question about potential dead code in vce_v2_0_enable_mgcg()
Date 2017-06-28 17:50 +0200
Message-ID <tXno6-dY-1@gated-at.bofh.it> (permalink)
References <tXm8G-7TU-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> -----Original Message-----
> From: Gustavo A. R. Silva [mailto:garsilva@embeddedor.com]
> Sent: Wednesday, June 28, 2017 10:22 AM
> To: Deucher, Alexander; Koenig, Christian; David Airlie
> Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-
> kernel@vger.kernel.org
> Subject: [gpu-drm-radeon] question about potential dead code in
> vce_v2_0_enable_mgcg()
> 
> 
> Hello everybody,
> 
> While looking into Coverity ID 1198635 I ran into the following piece
> of code at drivers/gpu/drm/radeon/vce_v2_0.c:107:
> 
> 107void vce_v2_0_enable_mgcg(struct radeon_device *rdev, bool enable)
> 108{
> 109        bool sw_cg = false;
> 110
> 111        if (enable && (rdev->cg_flags &
> RADEON_CG_SUPPORT_VCE_MGCG)) {
> 112                if (sw_cg)
> 113                        vce_v2_0_set_sw_cg(rdev, true);
> 114                else
> 115                        vce_v2_0_set_dyn_cg(rdev, true);
> 116        } else {
> 117                vce_v2_0_disable_cg(rdev);
> 118
> 119                if (sw_cg)
> 120                        vce_v2_0_set_sw_cg(rdev, false);
> 121                else
> 122                        vce_v2_0_set_dyn_cg(rdev, false);
> 123        }
> 124}
> 
> The issue here is that local variable sw_cg is never updated again
> after its initialization; which cause some code to be logically dead.
> 
> My question here is if such variable is there for testing purposes or
> if it is a sort of an old code leftover that should be removed?
> 
> In any case I can send a patch to add a comment or remove the dead code.
> 
> I'd really appreciate any comments on this.

I wanted to leave the code in for debugging if we ran into problems with dynamic clockgating.

Alex

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[gpu-drm-radeon] question about potential dead code in  vce_v2_0_enable_mgcg() "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-28 16:30 +0200
  RE: [gpu-drm-radeon] question about potential dead code in  vce_v2_0_enable_mgcg() "Deucher, Alexander" <Alexander.Deucher@amd.com> - 2017-06-28 17:50 +0200
    Re: [gpu-drm-radeon] question about potential dead code in  vce_v2_0_enable_mgcg() "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-29 01:10 +0200
      Re: [gpu-drm-radeon] question about potential dead code in vce_v2_0_enable_mgcg() Alex Deucher <alexdeucher@gmail.com> - 2017-06-29 14:40 +0200
        [PATCH] drm/radeon: add header comment for clarification to  vce_v2_0_enable_mgcg() "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-29 19:40 +0200
          Re: [PATCH] drm/radeon: add header comment for clarification to vce_v2_0_enable_mgcg() Alex Deucher <alexdeucher@gmail.com> - 2017-06-29 21:30 +0200
            Re: [PATCH] drm/radeon: add header comment for clarification to  vce_v2_0_enable_mgcg() "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-06-29 22:00 +0200

csiph-web