From patchwork Wed Aug 30 13:19:42 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: 9929637 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 301E560309 for ; Wed, 30 Aug 2017 13:43:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C6522860C for ; Wed, 30 Aug 2017 13:43:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 111462860F; Wed, 30 Aug 2017 13:43:02 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 131622860C for ; Wed, 30 Aug 2017 13:43:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751317AbdH3NnA (ORCPT ); Wed, 30 Aug 2017 09:43:00 -0400 Received: from gateway33.websitewelcome.com ([192.185.146.78]:45653 "EHLO gateway33.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751302AbdH3NnA (ORCPT ); Wed, 30 Aug 2017 09:43:00 -0400 X-Greylist: delayed 1396 seconds by postgrey-1.27 at vger.kernel.org; Wed, 30 Aug 2017 09:43:00 EDT Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 5AC584625CB for ; Wed, 30 Aug 2017 08:19:43 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id n2wWdvDo3R2HBn2wWdRZ65; Wed, 30 Aug 2017 08:22:04 -0500 Received: from [189.152.158.27] (port=47844 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.87) (envelope-from ) id 1dn2uF-002A3j-1N; Wed, 30 Aug 2017 08:19:43 -0500 Date: Wed, 30 Aug 2017 08:19:42 -0500 From: "Gustavo A. R. Silva" To: Thomas Winischhofer , Bartlomiej Zolnierkiewicz Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] video: fbdev: sis: fix duplicated code for different branches Message-ID: <20170830131942.GA8173@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 - 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: 189.152.158.27 X-Exim-ID: 1dn2uF-002A3j-1N X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.158.27]:47844 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 3 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Refactor code in order to avoid identical code for different branches. This issue was detected with the help of Coccinelle. Addresses-Coverity-ID: 1226761 Signed-off-by: Gustavo A. R. Silva --- This issue was reported by Coverity and it was tested by compilation only. Please, verify if any of these issues should be addressed differently. Also, notice that this code has been there since 2005. drivers/video/fbdev/sis/init301.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/video/fbdev/sis/init301.c b/drivers/video/fbdev/sis/init301.c index 20f7234..99d5a25 100644 --- a/drivers/video/fbdev/sis/init301.c +++ b/drivers/video/fbdev/sis/init301.c @@ -6848,8 +6848,6 @@ SiS_SetGroup2(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short if(SiS_Pr->SiS_VGAHDE >= 1280) { tempch = 20; tempbx &= ~0x20; - } else if(SiS_Pr->SiS_VGAHDE >= 1024) { - tempch = 25; } else { tempch = 25; /* OK */ } @@ -7964,14 +7962,9 @@ SiS_SetCHTVReg(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short } } } else { /* ---- PAL ---- */ - /* We don't play around with FSCI in PAL mode */ - if(resindex == 0x04) { - SiS_SetCH70xxANDOR(SiS_Pr,0x20,0x00,0xEF); /* loop filter off */ - SiS_SetCH70xxANDOR(SiS_Pr,0x21,0x01,0xFE); /* ACIV on */ - } else { - SiS_SetCH70xxANDOR(SiS_Pr,0x20,0x00,0xEF); /* loop filter off */ - SiS_SetCH70xxANDOR(SiS_Pr,0x21,0x01,0xFE); /* ACIV on */ - } + /* We don't play around with FSCI in PAL mode */ + SiS_SetCH70xxANDOR(SiS_Pr, 0x20, 0x00, 0xEF); /* loop filter off */ + SiS_SetCH70xxANDOR(SiS_Pr, 0x21, 0x01, 0xFE); /* ACIV on */ } #endif /* 300 */ @@ -9657,8 +9650,6 @@ SetDelayComp(struct SiS_Private *SiS_Pr, unsigned short ModeNo) delay = 0x0a; } else if(IS_SIS740) { delay = 0x00; - } else if(SiS_Pr->ChipType < SIS_330) { - delay = 0x0c; } else { delay = 0x0c; }