From patchwork Thu Nov 28 03:09:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 11265367 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D2F2112B for ; Thu, 28 Nov 2019 03:10:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F9A9206EC for ; Thu, 28 Nov 2019 03:10:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Yn35CFtR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F9A9206EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7saAyPOwHBlJBPCYKWF6QFQcsUJLs7DWFNsY1D2EYKs=; b=Yn35CFtR2rwT3+ tWbOqrFWkAu2yWI50Nx8fhhxz9XpRv3xqv9sxSWWUs7m2gq3vZ9XyMwF3n1V9fk7YMUVRbdwhv1w3 gye3WwYJHKLikN3lIEmRB2oDn0GCzfch5mOop3+LpnsGYakFKwJk5LWvR0gNi+QoAk/AazuMe4qDv Sh6ZgOSxOzPo4ZBpsaLN3TRyCOJtpCvf18EiuV9dgJyGoBXKgzjDCJBXE/oLWDutBdJipKf5baF07 MVcJGr3sInlGgTrnzeyIsIt23sDWqvjqx54BICKiFW/6kWLMcwp1WJVaTHTErRRwVugr4ki3GKeuw 62Iiac0m7enR3rhvWIRQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iaAC3-0002qw-B7; Thu, 28 Nov 2019 03:10:11 +0000 Received: from szxga06-in.huawei.com ([45.249.212.32] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iaABy-0002mG-Jm for linux-arm-kernel@lists.infradead.org; Thu, 28 Nov 2019 03:10:08 +0000 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 351A96ADCDBDC841C9DC; Thu, 28 Nov 2019 11:10:05 +0800 (CST) Received: from huawei.com (10.175.105.18) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Thu, 28 Nov 2019 11:09:55 +0800 From: linmiaohe To: , , , , , , , , , , , , Subject: [PATCH] KVM: arm64: eliminate unnecessary var err and jump label in set_core_reg() Date: Thu, 28 Nov 2019 11:09:58 +0800 Message-ID: <1574910598-14468-1-git-send-email-linmiaohe@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.105.18] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191127_191006_841427_D4FE75D9 X-CRM114-Status: GOOD ( 10.47 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.32 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linmiaohe@huawei.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Miaohe Lin The var err and jump label out isn't really needed in set_core_reg(). Clean them up. Signed-off-by: Miaohe Lin Reviewed-by: Eric Auger --- arch/arm64/kvm/guest.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 3b836c91609e..88eb6e5399ed 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -159,7 +159,6 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) __uint128_t tmp; void *valp = &tmp; u64 off; - int err = 0; /* Our ID is an index into the kvm_regs struct. */ off = core_reg_offset_from_id(reg->id); @@ -173,10 +172,8 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) if (KVM_REG_SIZE(reg->id) > sizeof(tmp)) return -EINVAL; - if (copy_from_user(valp, uaddr, KVM_REG_SIZE(reg->id))) { - err = -EFAULT; - goto out; - } + if (copy_from_user(valp, uaddr, KVM_REG_SIZE(reg->id))) + return -EFAULT; if (off == KVM_REG_ARM_CORE_REG(regs.pstate)) { u64 mode = (*(u64 *)valp) & PSR_AA32_MODE_MASK; @@ -200,14 +197,12 @@ static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) return -EINVAL; break; default: - err = -EINVAL; - goto out; + return -EINVAL; } } memcpy((u32 *)regs + off, valp, KVM_REG_SIZE(reg->id)); -out: - return err; + return 0; } #define vq_word(vq) (((vq) - SVE_VQ_MIN) / 64)