public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [SCSI] FlashPoint: optimize string comparison
@ 2015-07-07  5:39 Christophe JAILLET
  2015-07-07  8:45 ` Frans Klaver
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe JAILLET @ 2015-07-07  5:39 UTC (permalink / raw)
  To: khalid, JBottomley
  Cc: linux-scsi, linux-kernel, kernel-janitors, Christophe JAILLET

Stop comparing the strings as soon as we know that they don't match.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 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) {
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-08 15:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-07  5:39 [PATCH] [SCSI] FlashPoint: optimize string comparison Christophe JAILLET
2015-07-07  8:45 ` Frans Klaver
2015-07-07 17:04   ` Khalid Aziz
2015-07-08  5:45     ` Christophe JAILLET
2015-07-08  7:12       ` Frans Klaver
2015-07-08 13:59         ` Khalid Aziz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox