From patchwork Thu Jun 15 16:27:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 9790417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18F88602CB for ; Fri, 16 Jun 2017 00:53:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A8712846A for ; Fri, 16 Jun 2017 00:53:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F39EE2842B; Fri, 16 Jun 2017 00:53:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 78C8D28643 for ; Fri, 16 Jun 2017 00:53:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1ABB6E848; Fri, 16 Jun 2017 00:53:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1416 seconds by postgrey-1.35 at gabe; Thu, 15 Jun 2017 16:51:20 UTC Received: from gateway23.websitewelcome.com (gateway23.websitewelcome.com [192.185.49.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id D4A546E7DF for ; Thu, 15 Jun 2017 16:51:20 +0000 (UTC) Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway23.websitewelcome.com (Postfix) with ESMTP id A849414D93 for ; Thu, 15 Jun 2017 11:27:42 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id LXcRdPuYi6R1uLXcRdEfb0; Thu, 15 Jun 2017 11:27:40 -0500 Received: from [189.152.189.231] (port=46116 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.87) (envelope-from ) id 1dLXcT-003Rhg-Gl; Thu, 15 Jun 2017 11:27:41 -0500 Date: Thu, 15 Jun 2017 11:27:40 -0500 From: "Gustavo A. R. Silva" To: Dave Airlie , David Airlie Subject: [PATCH] gpu: drm: mgag200: remove unnecessary variable in mga_crtc_mode_set Message-ID: <20170615162740.GA19088@embeddedgus> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) 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 - lists.freedesktop.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.152.189.231 X-Exim-ID: 1dLXcT-003Rhg-Gl X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.189.231]:46116 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 3 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Mailman-Approved-At: Fri, 16 Jun 2017 00:53:09 +0000 Cc: "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Remove unnecessary variable _misc_ and refactor the code. A value is assigned to variable _misc_ at lines 1002 and 1004 and then overwritten at line 1127, just before it can be used. Besides, this variable is only being used as an argument when calling macro WREG8() and, it is not implied in any other operation. Addresses-Coverity-ID: 1397681 Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/mgag200/mgag200_mode.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index adb411a..960e43b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -923,7 +923,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, int pitch; int option = 0, option2 = 0; int i; - unsigned char misc = 0; unsigned char ext_vga[6]; u8 bppshift; @@ -998,11 +997,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, break; } - if (mode->flags & DRM_MODE_FLAG_NHSYNC) - misc |= 0x40; - if (mode->flags & DRM_MODE_FLAG_NVSYNC) - misc |= 0x80; - for (i = 0; i < sizeof(dacvalue); i++) { if ((i <= 0x17) || @@ -1124,8 +1118,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, ext_vga[1] |= 0x88; /* Set pixel clocks */ - misc = 0x2d; - WREG8(MGA_MISC_OUT, misc); + WREG8(MGA_MISC_OUT, 0x2d); mga_crtc_set_plls(mdev, mode->clock); @@ -1145,9 +1138,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, WREG_ECRT(0, ext_vga[0]); /* Enable mga pixel clock */ - misc = 0x2d; - - WREG8(MGA_MISC_OUT, misc); + WREG8(MGA_MISC_OUT, 0x2d); if (adjusted_mode) memcpy(&mdev->mode, mode, sizeof(struct drm_display_mode));