Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6291182ybc; Wed, 27 Nov 2019 19:13:02 -0800 (PST) X-Google-Smtp-Source: APXvYqyN9+g2ryBKVX+fszPxQBv8E3iVbfOMmmpCwWf0kwDAm7Hk0zx4GdbZEhXq4R6fWeYp/1RD X-Received: by 2002:a05:6402:1a45:: with SMTP id bf5mr5511745edb.265.1574910782089; Wed, 27 Nov 2019 19:13:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574910782; cv=none; d=google.com; s=arc-20160816; b=ETnSX/NaacvqY55aAsXfArFHDm/0gtZVwZ+dNk5Qjrku5H0qHtaheZYzWAAEs7Cz1v eHExg9HMgWda4LHOyvR7cKr8Qo8ypLXgJwpNGEJPeWaw5S8AsEU26kgJ5+MXsigagMRx FMzm3DDjH0VsHi/X4aWOgMc/9aRDkyKx/Zj8oYIYnU+Z7nv6BPrrvv1lFc2A0hcjl4ij V4W5QypYmocAVtDhr0zCInDPQYgWFaJ5ooyFe/9ylDGQYRhOcuDOmgEUEhGbQXIxqFld DZeICypwRM+GIO5TbDS/1SKYys7AtOU0AivkhA6HWVImEvh4rY7BelbgJB6C8A2af6Zz pxgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=zqeauF8YO6o6SYtwLIfclsXXFhr++12Ke0aiIG+uXas=; b=NfN5FoqYCaHd1ax0VUk3kMEZv9KIIuw/YRRszkaG4D352TkAwG9KXCcr06fDwrADRZ boGVq1KpnN9MUq6XyLPI59ULhEuzT2TiuVzOXtzdjGBjAueCqyJnb0hWRv+iiUtpI5q1 xa5gsK0aeuWc1PiwR68cQKPeNTN36TvIHSkXErLuqU0eyExXoFEmuI0Z0uxDxu8VQOF+ 5sHpy7qAvACIji2tq+N60gitaNWy2Ys11gJqqa0GGumPBcLTnXRNEsmU5Ys0bk0KDqEW +GRhdEY0iiheqBloznzRF9ECWjnS1bsgO5Dnzl6sWuIiZCxBn8ETKqMn7FX6akYJH+Xp SxKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si10357496ejm.348.2019.11.27.19.12.37; Wed, 27 Nov 2019 19:13:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727789AbfK1DKH (ORCPT + 99 others); Wed, 27 Nov 2019 22:10:07 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:53054 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727113AbfK1DKH (ORCPT ); Wed, 27 Nov 2019 22:10:07 -0500 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: , , , , , , , , , , , , CC: , , , , 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 Content-Type: text/plain X-Originating-IP: [10.175.105.18] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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) -- 2.19.1