From patchwork Mon Mar 18 10:21:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Feng X-Patchwork-Id: 2288091 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 335FEDF215 for ; Mon, 18 Mar 2013 11:11:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751581Ab3CRLLl (ORCPT ); Mon, 18 Mar 2013 07:11:41 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:41715 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751412Ab3CRLLk (ORCPT ); Mon, 18 Mar 2013 07:11:40 -0400 X-IronPort-AV: E=Sophos;i="4.84,865,1355068800"; d="scan'208";a="6893846" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 18 Mar 2013 19:09:10 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r2IAJUl4003758; Mon, 18 Mar 2013 18:19:33 +0800 Received: from linfeng-fedora.fnst.cn.fujitsu.com ([10.167.233.167]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013031818180783-944247 ; Mon, 18 Mar 2013 18:18:07 +0800 From: Lin Feng To: akpm@linux-foundation.org, bhelgaas@google.com Cc: linux-mm@kvack.org, x86@kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, yinghai@kernel.org, Lin Feng Subject: [PATCH] kernel/range.c: subtract_range: return instead of continue to save some loops Date: Mon, 18 Mar 2013 18:21:49 +0800 Message-Id: <1363602109-12001-1-git-send-email-linfeng@cn.fujitsu.com> X-Mailer: git-send-email 1.8.0.1 X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/18 18:18:08, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/18 18:18:15, Serialize complete at 2013/03/18 18:18:15 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org If we fall into that branch it means that there is a range fully covering the subtract range, so it's suffice to return there if there isn't any other overlapping ranges. Also fix the broken phrase issued by printk. Cc: Yinghai Lu Signed-off-by: Lin Feng --- kernel/range.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/range.c b/kernel/range.c index 9b8ae2d..223c6fe 100644 --- a/kernel/range.c +++ b/kernel/range.c @@ -97,10 +97,10 @@ void subtract_range(struct range *range, int az, u64 start, u64 end) range[i].end = range[j].end; range[i].start = end; } else { - printk(KERN_ERR "run of slot in ranges\n"); + printk(KERN_ERR "run out of slot in ranges\n"); } range[j].end = start; - continue; + return; } } }