From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752319AbdGCB1D (ORCPT ); Sun, 2 Jul 2017 21:27:03 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35043 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752207AbdGCB0y (ORCPT ); Sun, 2 Jul 2017 21:26:54 -0400 Date: Mon, 3 Jul 2017 09:26:47 +0800 From: Lynn Lei To: sudipm.mukherjee@gmail.com Cc: teddy.wang@siliconmotion.com, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH] staging: sm750fb: skip unnecessary comparisons Message-ID: <20170703001809.GA1480@lynnl.wit> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org introduced early checks to skip unnecessary comparisons when flags set. Signed-off-by: Lynn Lei --- drivers/staging/sm750fb/sm750.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 386d4adcd91d..9e57a2d32465 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -1171,11 +1171,16 @@ static int __init lynxfb_setup(char *options) */ while ((opt = strsep(&options, ":")) != NULL) { /* options that mean for any lynx chips are configured here */ - if (!strncmp(opt, "noaccel", strlen("noaccel"))) { + + /* + * NOTE: the length of options is hard-coded + * if any of those options changed please update its length + */ + if (!g_noaccel && !strncmp(opt, "noaccel", 7)) { g_noaccel = 1; - } else if (!strncmp(opt, "nomtrr", strlen("nomtrr"))) { + } else if (!g_nomtrr && !strncmp(opt, "nomtrr", 6)) { g_nomtrr = 1; - } else if (!strncmp(opt, "dual", strlen("dual"))) { + } else if (!g_dualview && !strncmp(opt, "dual", 4)) { g_dualview = 1; } else { strcat(tmp, opt); -- 2.13.2