Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752355AbdF1OWl (ORCPT ); Wed, 28 Jun 2017 10:22:41 -0400 Received: from gateway24.websitewelcome.com ([192.185.51.35]:39190 "EHLO gateway24.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751745AbdF1OWe (ORCPT ); Wed, 28 Jun 2017 10:22:34 -0400 Date: Wed, 28 Jun 2017 09:22:29 -0500 Message-ID: <20170628092229.Horde.Hsk18WJyYojTJE5OKzhVd3d@gator4166.hostgator.com> From: "Gustavo A. R. Silva" To: Alex Deucher , Christian =?utf-8?b?S8O2bmln?= , 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() User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 108.167.133.22 X-Exim-ID: 1dQDrR-000eNM-9u X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: gator4166.hostgator.com [108.167.133.22]:58793 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 1 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1199 Lines: 44 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. Thank you! -- Gustavo A. R. Silva