From patchwork Tue Jul 7 05:39:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 6730121 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4FB549F38C for ; Tue, 7 Jul 2015 05:46:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C16220770 for ; Tue, 7 Jul 2015 05:46:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EF53020780 for ; Tue, 7 Jul 2015 05:46:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754080AbbGGFqn (ORCPT ); Tue, 7 Jul 2015 01:46:43 -0400 Received: from smtp07.smtpout.orange.fr ([80.12.242.129]:35483 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753837AbbGGFqn (ORCPT ); Tue, 7 Jul 2015 01:46:43 -0400 X-Greylist: delayed 452 seconds by postgrey-1.27 at vger.kernel.org; Tue, 07 Jul 2015 01:46:42 EDT Received: from localhost.localdomain ([92.140.216.36]) by mwinf5d14 with ME id pHf51q00K0nhuJ403Hf6Wz; Tue, 07 Jul 2015 07:39:08 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 07 Jul 2015 07:39:08 +0200 X-ME-IP: 92.140.216.36 From: Christophe JAILLET To: khalid@gonehiking.org, JBottomley@odin.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] [SCSI] FlashPoint: optimize string comparison Date: Tue, 7 Jul 2015 07:39:03 +0200 Message-Id: <1436247543-7326-1-git-send-email-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.1.4 X-Antivirus: avast! (VPS 150706-2, 06/07/2015), Outbound message X-Antivirus-Status: Clean Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 Stop comparing the strings as soon as we know that they don't match. Signed-off-by: Christophe JAILLET --- drivers/scsi/FlashPoint.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c index 5c74e4c..24a4d1a 100644 --- a/drivers/scsi/FlashPoint.c +++ b/drivers/scsi/FlashPoint.c @@ -6280,8 +6280,10 @@ static unsigned char FPT_scmachid(unsigned char p_card, match = 1; for (k = 0; k < ID_STRING_LENGTH; k++) { - if (p_id_string[k] != FPT_scamInfo[i].id_string[k]) + if (p_id_string[k] != FPT_scamInfo[i].id_string[k]) { match = 0; + break; + } } if (match) {