From patchwork Tue Jun 9 13:04:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 6572541 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0EB7EC0433 for ; Tue, 9 Jun 2015 13:05:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 343A4204D9 for ; Tue, 9 Jun 2015 13:05:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A24AA204DF for ; Tue, 9 Jun 2015 13:05:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932795AbbFINE5 (ORCPT ); Tue, 9 Jun 2015 09:04:57 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:32821 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753805AbbFINE4 (ORCPT ); Tue, 9 Jun 2015 09:04:56 -0400 Received: by lbcue7 with SMTP id ue7so10223852lbc.0 for ; Tue, 09 Jun 2015 06:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id; bh=CWGfudnQutg9a3oag8GJG6lC3snClEddDjzcXuAwqi8=; b=cE5eE7Y/sownc3dxGLiZC77cQe3dyU6n9DQ61FyFnSk9UvVRO2n08iLxA6D3Jq6/W1 7E6tvrMgWHBBLHpkZjLH51+ef04Wot07ChNpriRt0KX08NfggKzizCC1DA2QxDw/TjqZ GP0h49qpYl0LSpcRca1eszeYJoXPiX3Lac1No= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CWGfudnQutg9a3oag8GJG6lC3snClEddDjzcXuAwqi8=; b=GrNoIvQvDZF1VqyTdp8LN8UruFs0OKQnCeYp/aIQGHFLfjvf7lc0bbjPbOtlgP1Aa9 3mQr6WasahfX0+66h3bO8sZA3EgEZvKcsdXOuLlUxnIv17aEbB7EuUHqsjyIHA8XvhyU zUuFSILmL4B4h+I0MU6xgQp9Pf1egxXkrkZtyX0o5eE4wlqXQqhjgO8DHq8aSeV424zE WY/0yWR4DySuOMojCnODzIgYES8icMDqi3z+kAmo0UV+wHqyqRLDQgfbEom80i8glScH N1G8djOzQZahTc7kGSa7XHo3Fd3LqMJcybPJsSZqarHL3GMxhBfjV9k/4RnDO7J2x1IX GV5Q== X-Gm-Message-State: ALoCoQmEJgZ7aVoJt/BriEGTgK1G+TzFWf3y0JuyKnwJF1TJO3fsX9xVh8oAwntw2nWttRw2mxiR X-Received: by 10.112.163.101 with SMTP id yh5mr14333137lbb.25.1433855093905; Tue, 09 Jun 2015 06:04:53 -0700 (PDT) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id k10sm1383529lbq.9.2015.06.09.06.04.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2015 06:04:52 -0700 (PDT) From: Rasmus Villemoes To: Thomas Winischhofer , Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: Rasmus Villemoes , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers/video/fbdev/sis/sis_main.c: avoid repeated strlen() calls Date: Tue, 9 Jun 2015 15:04:26 +0200 Message-Id: <1433855066-20260-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gcc is not smart enough to realize that strlen(strbuf1) cannot be changed by the loop body, so it is forced to recompute it, at least in the branch containing the assignment. Avoid this by using an equivalent stopping condition. Signed-off-by: Rasmus Villemoes --- drivers/video/fbdev/sis/sis_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c index fcf610edf217..ea95f8bf3922 100644 --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -172,7 +172,7 @@ static void sisfb_search_mode(char *name, bool quiet) if(strlen(name) <= 19) { strcpy(strbuf1, name); - for(i = 0; i < strlen(strbuf1); i++) { + for(i = 0; strbuf1[i]; i++) { if(strbuf1[i] < '0' || strbuf1[i] > '9') strbuf1[i] = ' '; }