From patchwork Fri Nov 11 12:24:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Shukla X-Patchwork-Id: 9422945 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 07D42601C0 for ; Fri, 11 Nov 2016 12:27:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEF94296DC for ; Fri, 11 Nov 2016 12:27:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3BFC296E3; Fri, 11 Nov 2016 12:27:45 +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 9C98C296DC for ; Fri, 11 Nov 2016 12:27:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932268AbcKKM1Z (ORCPT ); Fri, 11 Nov 2016 07:27:25 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:38048 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756457AbcKKM1Y (ORCPT ); Fri, 11 Nov 2016 07:27:24 -0500 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGH022N398IDT00@mailout1.samsung.com>; Fri, 11 Nov 2016 21:27:22 +0900 (KST) X-AuditID: cbfee61a-f79916d0000062de-a3-5825b9297a47 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id B9.5A.25310.929B5285; Fri, 11 Nov 2016 21:27:22 +0900 (KST) Received: from localhost.localdomain ([107.108.168.37]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OGH000K098W2850@mmp1.samsung.com>; Fri, 11 Nov 2016 21:27:21 +0900 (KST) From: Sachin Shukla To: Timur Tabi , Tomi Valkeinen , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, sachiniiitm@gmail.com Cc: ravikant.s2@samsung.com, p.shailesh@samsung.com, ashish.kalra@samsung.com, vidushi.koul@samsung.com Subject: [PATCH] Video: fbdev: Remove impossible condition. Date: Fri, 11 Nov 2016 17:54:50 +0530 Message-id: <1478867090-2108-1-git-send-email-sachin.s5@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLLMWRmVeSWpSXmKPExsVy+t9jAV2tnaoRBjO7WSzuT/vGbrFn70kW i8u75rBZ7JjSymLR1DCb3eLBornMFk1P1jNarJ9/i83i78VLbA6cHjtn3WX36NuyitFj+4LZ bB7Hb2xn8vi8SS6ANcrNJiM1MSW1SCE1Lzk/JTMv3VYpNMRN10JJIS8xN9VWKULXNyRISaEs MacUyDMyQAMOzgHuwUr6dgluGT8nXWcv+CxY0fnSuIFxO18XIyeHhICJxMz1TUwQtpjEhXvr 2boYuTiEBJYySix9uo8ZwvnJKLHi1AZWkCo2AW2JD/3zWUASIgLzGSUWrFvC3sXIwcEskCnR 0lABUiMsYC3RPvciG4jNIqAqseTuRrANvAIuEv239zOBlEsIKEjMmWQzgZF7ASPDKkaJ1ILk guKk9FzDvNRyveLE3OLSvHS95PzcTYzgoH0mtYPx4C73Q4wCHIxKPLwSWaoRQqyJZcWVuYcY JTiYlUR4HXYAhXhTEiurUovy44tKc1KLDzGaAu2fyCwlmpwPjKi8knhDE3MTc2MDC3NLSxMj JXHextnPwoUE0hNLUrNTUwtSi2D6mDg4pRoYexzfurR3H7o69ZDwnJkPGdapsZ5iSdJsflDf vPvd8a162zszW1T2lu3dz/HtzeXM02dKf/xd7Su6/W1d4esDdoa+ndWfru5e/3j+mz+/V2zf XyW6WlLv2jSzsKXPHp/L6K7b03e508Zyy7nUP0u8Jz2qX1/4ZbfUK84NM95/+bHT8k344ycM E58qsRRnJBpqMRcVJwIADknjSHACAAA= X-MTR: 20000000000000000@CPGS Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Sachin Shukla" xoffset and yoffset of struct fb_var_screeninfo are unsigned and so they can never be less than 0. Signed-off-by: Sachin Shukla Acked-by: Timur Tabi --- drivers/video/fbdev/amifb.c | 8 +++----- drivers/video/fbdev/fsl-diu-fb.c | 9 +-------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c index 1d702e1..cc11c60 100644 --- a/drivers/video/fbdev/amifb.c +++ b/drivers/video/fbdev/amifb.c @@ -1484,13 +1484,11 @@ static int ami_decode_var(struct fb_var_screeninfo *var, struct amifb_par *par, par->xoffset = var->xoffset; par->yoffset = var->yoffset; if (par->vmode & FB_VMODE_YWRAP) { - if (par->xoffset || par->yoffset < 0 || - par->yoffset >= par->vyres) + if (par->yoffset >= par->vyres) par->xoffset = par->yoffset = 0; } else { - if (par->xoffset < 0 || - par->xoffset > upx(16 << maxfmode, par->vxres - par->xres) || - par->yoffset < 0 || par->yoffset > par->vyres - par->yres) + if (par->xoffset > upx(16 << maxfmode, par->vxres - par->xres) || + par->yoffset > par->vyres - par->yres) par->xoffset = par->yoffset = 0; } } else diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c index fe00a07..c48a59e 100644 --- a/drivers/video/fbdev/fsl-diu-fb.c +++ b/drivers/video/fbdev/fsl-diu-fb.c @@ -703,12 +703,6 @@ static int fsl_diu_check_var(struct fb_var_screeninfo *var, if (var->yres_virtual < var->yres) var->yres_virtual = var->yres; - if (var->xoffset < 0) - var->xoffset = 0; - - if (var->yoffset < 0) - var->yoffset = 0; - if (var->xoffset + info->var.xres > info->var.xres_virtual) var->xoffset = info->var.xres_virtual - info->var.xres; @@ -1254,8 +1248,7 @@ static int fsl_diu_pan_display(struct fb_var_screeninfo *var, (info->var.yoffset == var->yoffset)) return 0; /* No change, do nothing */ - if (var->xoffset < 0 || var->yoffset < 0 - || var->xoffset + info->var.xres > info->var.xres_virtual + if (var->xoffset + info->var.xres > info->var.xres_virtual || var->yoffset + info->var.yres > info->var.yres_virtual) return -EINVAL;