From patchwork Thu Apr 5 09:36:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li RongQing X-Patchwork-Id: 150898 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1B5B1B7028 for ; Thu, 5 Apr 2012 19:36:40 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753855Ab2DEJgi (ORCPT ); Thu, 5 Apr 2012 05:36:38 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:59240 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753686Ab2DEJgh (ORCPT ); Thu, 5 Apr 2012 05:36:37 -0400 Received: by qcro28 with SMTP id o28so721598qcr.19 for ; Thu, 05 Apr 2012 02:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer; bh=Zfnd3FDhqYBJugf3k4vCyGPwh8pnZeXNNI4LjZoYgTs=; b=DA3yPzF0zvN6UuMD2o6TwT+vX8mtK37cUnlzYpltjwi9Fpn/dJW3QCvVEkir0JNx7W WOJcUSRtgXkgJvAjc0nPndd0pt9MORgwCC+wcLddrJ8lDvS28/DLSNdIqZyIrN1KJzgx L39YiVQj7EYpzvbqZpPQ0XelXGbKpzZ4XafygbeuIqWDjxmSZkxyetfTIucGzKiVSozT rqvOFVCuY7cL/sSletdlf88VKFu/w7sFlwdGfj0vf0qK/eiYwL183SafjS4Qvvx3S8Zv 5ZfZdhZu4rTTfF15ZihT/PY51ldZlRAnRZImWcTS/REvScj6+5jLqLkrwDvaVXJiaaYW mxQQ== Received: by 10.229.136.66 with SMTP id q2mr711341qct.32.1333618596334; Thu, 05 Apr 2012 02:36:36 -0700 (PDT) Received: from localhost ([61.148.56.138]) by mx.google.com with ESMTPS id de7sm3325568qab.16.2012.04.05.02.36.34 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Apr 2012 02:36:35 -0700 (PDT) From: roy.qing.li@gmail.com To: netdev@vger.kernel.org Subject: [PATCH net-next] net: replace continue with break to reduce unnecessary loop in xxx_xmarksources Date: Thu, 5 Apr 2012 17:36:29 +0800 Message-Id: <1333618589-13839-1-git-send-email-roy.qing.li@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: RongQing.Li The conditional which decides to skip inactive filters does not change with the change of loop index, so it is unnecessary to check them many times. Signed-off-by: RongQing.Li --- net/ipv4/igmp.c | 2 +- net/ipv6/mcast.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 5dfecfd..ceaac24 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -774,7 +774,7 @@ static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) if (psf->sf_count[MCAST_INCLUDE] || pmc->sfcount[MCAST_EXCLUDE] != psf->sf_count[MCAST_EXCLUDE]) - continue; + break; if (srcs[i] == psf->sf_inaddr) { scount++; break; diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index b2869ca..7dfb89f 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -1061,7 +1061,7 @@ static int mld_xmarksources(struct ifmcaddr6 *pmc, int nsrcs, if (psf->sf_count[MCAST_INCLUDE] || pmc->mca_sfcount[MCAST_EXCLUDE] != psf->sf_count[MCAST_EXCLUDE]) - continue; + break; if (ipv6_addr_equal(&srcs[i], &psf->sf_addr)) { scount++; break;