Message ID | 202211231704457807160@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2675428wrr; Wed, 23 Nov 2022 01:06:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf6dkmPHS9+MXVWTNUh7a3ut3JrZKTupXqyOfSD1m6T2dHNJSdLi4iMQQMMurIyaosL5eB7x X-Received: by 2002:a17:906:660e:b0:78d:b43c:81be with SMTP id b14-20020a170906660e00b0078db43c81bemr13456229ejp.600.1669194376399; Wed, 23 Nov 2022 01:06:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669194376; cv=none; d=google.com; s=arc-20160816; b=we7c3sf1j3/PeKJB72uiHFrpt81PWOd7jEI4M9FLCUo5Aqao8P7MDvhCMpV2Sdny9X RruPI/GMViNzDgq1iY4m90tuNcNDGFuF0BuQFuSh5GpfvcSCId2FvnT4TMXkUxKLaYjX TDIJhcS9IiU3I5wHe8SpexqJsxFHN7MeX2uwbX0mlvFF6n+Xv5ntQ8WnyPDinZ4S5NwX TJukEdNcWcWO4kOIFXyQslgWJj9f7OCRGnaJeYysXSaAWd1zkrrIqo8nnXjG/5U2Rbre fcqrIO67RwD+3dsK9WHlRes8c9P4oW5xgje3HRbAcYSLksIbcP7cOupLfnXCWCcezd2k edHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=3gMUP3TpYi8p2iBpjechkyVvueO5TqUb54W7tze/T2k=; b=ecxj7sx+/mEa6nGcZ0pjjLeGzh1Y+y9BJePgOcvXHZtyaJh3XjXlqQTcKC3y3XOwHm LhF9//0+ak/jD16b4xUmSQyuw2Wp6Dcan2Akae2eN/DFvSRu/EI37ZjmzK82YAftPBIy zXDYbwta9VbLqqsg2A4U5Q4cJ0cUDpQt9jeseTYZEoxtBF+Qr6KMI3vtxOnfIDNCM8e2 g6UFchSUEXb2L2M78kZ/B6wmQNB5Wbumk1Z889HlNQnbDrJMloOdhUe1Rdk0x4A2/0KP KAObd2xDx97RxYbeWJgahotqGwphBKyis32dYLq5zGPme00aA4ujgEMCxdHKyXacWMu5 b5+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r9-20020a1709063d6900b0077ef3eece57si11194522ejf.144.2022.11.23.01.05.51; Wed, 23 Nov 2022 01:06:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236949AbiKWJFL (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Wed, 23 Nov 2022 04:05:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236960AbiKWJEy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 23 Nov 2022 04:04:54 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D895DFFAAB; Wed, 23 Nov 2022 01:04:52 -0800 (PST) Received: from mxct.zte.com.cn (unknown [192.168.251.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NHFZC2p6Xz4xVnf; Wed, 23 Nov 2022 17:04:51 +0800 (CST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NHFZ94qlgz4xyCN; Wed, 23 Nov 2022 17:04:49 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2AN94heK059175; Wed, 23 Nov 2022 17:04:43 +0800 (+08) (envelope-from zhang.songyi@zte.com.cn) Received: from mapi (xaxapp02[null]) by mapi (Zmail) with MAPI id mid31; Wed, 23 Nov 2022 17:04:45 +0800 (CST) Date: Wed, 23 Nov 2022 17:04:45 +0800 (CST) X-Zmail-TransId: 2afa637de22dffffffff95a3dc38 X-Mailer: Zmail v1.0 Message-ID: <202211231704457807160@zte.com.cn> Mime-Version: 1.0 From: <zhang.songyi@zte.com.cn> To: <seanjc@google.com> Cc: <pbonzini@redhat.com>, <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>, <dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>, <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <zhang.songyi@zte.com.cn> Subject: =?utf-8?q?=5BPATCH_linux-next=5D_KVM=3A_x86=3A_remove_redundant_ret?= =?utf-8?q?_variable?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2AN94heK059175 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 637DE233.000 by FangMail milter! X-FangMail-Envelope: 1669194291/4NHFZC2p6Xz4xVnf/637DE233.000/192.168.251.13/[192.168.251.13]/mxct.zte.com.cn/<zhang.songyi@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 637DE233.000/4NHFZC2p6Xz4xVnf X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750277162377798002?= X-GMAIL-MSGID: =?utf-8?q?1750277162377798002?= |
Series |
[linux-next] KVM: x86: remove redundant ret variable
|
|
Commit Message
zhang.songyi@zte.com.cn
Nov. 23, 2022, 9:04 a.m. UTC
From: zhang songyi <zhang.songyi@zte.com.cn> Return value from apic_get_tmcct() directly instead of taking this in another redundant variable. Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn> --- arch/x86/kvm/lapic.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.15.2
Comments
On Wed, Nov 23, 2022, zhang.songyi@zte.com.cn wrote: > From: zhang songyi <zhang.songyi@zte.com.cn> > > Return value from apic_get_tmcct() directly instead of taking > this in another redundant variable. > > Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn> > --- > arch/x86/kvm/lapic.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index d7639d126e6c..707970804502 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -1363,7 +1363,6 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) > { > ktime_t remaining, now; > s64 ns; > - u32 tmcct; > > ASSERT(apic != NULL); > > @@ -1378,10 +1377,9 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) > remaining = 0; > > ns = mod_64(ktime_to_ns(remaining), apic->lapic_timer.period); > - tmcct = div64_u64(ns, > - (APIC_BUS_CYCLE_NS * apic->divide_count)); > > - return tmcct; > + return div64_u64(ns, > + (APIC_BUS_CYCLE_NS * apic->divide_count)); No need to wrap here, this fits comfortably on a single line (so does the existing code, i.e. not your "bug"). No need for v2, I'll fix up when applying.
On Wed, 23 Nov 2022 17:04:45 +0800, zhang.songyi@zte.com.cn wrote: > Return value from apic_get_tmcct() directly instead of taking > this in another redundant variable. This patch was whitespace damaged, please fix your setup. I manually applied it (and one other) since it's a trivial change, but I likely won't have that luxury for future patches. Applied to kvm-x86 apic, thanks! [1/1] KVM: x86: remove redundant ret variable https://github.com/kvm-x86/linux/commit/14bd05184168 -- https://github.com/kvm-x86/linux/tree/next https://github.com/kvm-x86/linux/tree/fixes
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index d7639d126e6c..707970804502 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1363,7 +1363,6 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) { ktime_t remaining, now; s64 ns; - u32 tmcct; ASSERT(apic != NULL); @@ -1378,10 +1377,9 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic) remaining = 0; ns = mod_64(ktime_to_ns(remaining), apic->lapic_timer.period); - tmcct = div64_u64(ns, - (APIC_BUS_CYCLE_NS * apic->divide_count)); - return tmcct; + return div64_u64(ns, + (APIC_BUS_CYCLE_NS * apic->divide_count)); } static void __report_tpr_access(struct kvm_lapic *apic, bool write)