From patchwork Fri Jan 11 09:26:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 1965231 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A08CF3FE37 for ; Fri, 11 Jan 2013 09:25:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753326Ab3AKJZf (ORCPT ); Fri, 11 Jan 2013 04:25:35 -0500 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]:41227 "EHLO tama500.ecl.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752873Ab3AKJZe (ORCPT ); Fri, 11 Jan 2013 04:25:34 -0500 Received: from mfs6.rdh.ecl.ntt.co.jp (mfs6.rdh.ecl.ntt.co.jp [129.60.39.149]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id r0B9PUVS013459; Fri, 11 Jan 2013 18:25:30 +0900 Received: from mfs6.rdh.ecl.ntt.co.jp (localhost.localdomain [127.0.0.1]) by mfs6.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id D1F6BE0194; Fri, 11 Jan 2013 18:25:30 +0900 (JST) Received: from imail2.m.ecl.ntt.co.jp (imail2.m.ecl.ntt.co.jp [129.60.5.247]) by mfs6.rdh.ecl.ntt.co.jp (Postfix) with ESMTP id BC997E018E; Fri, 11 Jan 2013 18:25:30 +0900 (JST) Received: from yshpad ([129.60.241.180]) by imail2.m.ecl.ntt.co.jp (8.13.8/8.13.8) with SMTP id r0B9PUkj022651; Fri, 11 Jan 2013 18:25:30 +0900 Date: Fri, 11 Jan 2013 18:26:10 +0900 From: Takuya Yoshikawa To: mtosatti@redhat.com, gleb@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH 1/4] KVM: set_memory_region: Don't jump to out_free unnecessarily Message-Id: <20130111182610.3dc138d7.yoshikawa_takuya_b1@lab.ntt.co.jp> In-Reply-To: <20130111182518.6c5975d9.yoshikawa_takuya_b1@lab.ntt.co.jp> References: <20130111182518.6c5975d9.yoshikawa_takuya_b1@lab.ntt.co.jp> X-Mailer: Sylpheed 3.1.0 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This makes the separation between the sanity checks and the rest of the code a bit clearer. Signed-off-by: Takuya Yoshikawa --- virt/kvm/kvm_main.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index e45c20c..d5e4bf9 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -778,9 +778,9 @@ int __kvm_set_memory_region(struct kvm *kvm, */ r = -EINVAL; if (npages && old.npages && npages != old.npages) - goto out_free; + goto out; if (!npages && !old.npages) - goto out_free; + goto out; /* Check for overlaps */ r = -EEXIST; @@ -789,7 +789,7 @@ int __kvm_set_memory_region(struct kvm *kvm, continue; if (!((base_gfn + npages <= slot->base_gfn) || (base_gfn >= slot->base_gfn + slot->npages))) - goto out_free; + goto out; } /* Free page dirty bitmap if unneeded */ @@ -891,7 +891,6 @@ out_free: kvm_free_physmem_slot(&new, &old); out: return r; - } EXPORT_SYMBOL_GPL(__kvm_set_memory_region);