From patchwork Wed Nov 2 12:37:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhang.songyi@zte.com.cn X-Patchwork-Id: 13028086 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78E0DC4332F for ; Wed, 2 Nov 2022 12:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229934AbiKBMpX (ORCPT ); Wed, 2 Nov 2022 08:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229598AbiKBMpV (ORCPT ); Wed, 2 Nov 2022 08:45:21 -0400 X-Greylist: delayed 367 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 02 Nov 2022 05:45:20 PDT Received: from mxus.zte.com.cn (mxus.zte.com.cn [20.112.44.237]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE09238B8; Wed, 2 Nov 2022 05:45:20 -0700 (PDT) Received: from mxhk.zte.com.cn (unknown [192.168.250.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxus.zte.com.cn (FangMail) with ESMTPS id 4N2RJP5pstz9tyD7; Wed, 2 Nov 2022 20:38:29 +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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4N2RHq6VKpz5BNRf; Wed, 2 Nov 2022 20:37:59 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2A2CbsFU049223; Wed, 2 Nov 2022 20:37:54 +0800 (+08) (envelope-from zhang.songyi@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Wed, 2 Nov 2022 20:37:57 +0800 (CST) Date: Wed, 2 Nov 2022 20:37:57 +0800 (CST) X-Zmail-TransId: 2af9636264a57d5a1a4f X-Mailer: Zmail v1.0 Message-ID: <202211022037573160098@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , , Subject: =?utf-8?q?=5BPATCH_linux-next=5D_x86/MCE/AMD=3A_remove_redundant_re?= =?utf-8?q?t_variable?= X-MAIL: mse-fl2.zte.com.cn 2A2CbsFU049223 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at 10-207-168-7 with ID 636264C4.000 by FangMail milter! X-FangMail-Envelope: 1667392710/4N2RJP5pstz9tyD7/636264C4.000/192.168.250.138/[192.168.250.138]/mxhk.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 636264C4.000/4N2RJP5pstz9tyD7 Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From 7fd536f480bfd526f40870c1567caf3263a584e7 Mon Sep 17 00:00:00 2001 From: zhang songyi Date: Wed, 2 Nov 2022 16:48:44 +0800 Subject: [PATCH linux-next] x86/MCE/AMD: remove redundant ret variable Return value from show() and store() directly instead of taking this in another redundant variable. Reported-by: Zeal Robot Signed-off-by: zhang songyi --- arch/x86/kernel/cpu/mce/amd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) -- 2.15.2 diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c index 10fb5b5c9efa..425d0803eeb6 100644 --- a/arch/x86/kernel/cpu/mce/amd.c +++ b/arch/x86/kernel/cpu/mce/amd.c @@ -1009,11 +1009,8 @@ static ssize_t show(struct kobject *kobj, struct attribute *attr, char *buf) { struct threshold_block *b = to_block(kobj); struct threshold_attr *a = to_attr(attr); - ssize_t ret; - ret = a->show ? a->show(b, buf) : -EIO; - - return ret; + return a->show ? a->show(b, buf) : -EIO; } static ssize_t store(struct kobject *kobj, struct attribute *attr, @@ -1021,11 +1018,8 @@ static ssize_t store(struct kobject *kobj, struct attribute *attr, { struct threshold_block *b = to_block(kobj); struct threshold_attr *a = to_attr(attr); - ssize_t ret; - - ret = a->store ? a->store(b, buf, count) : -EIO; - return ret; + return a->store ? a->store(b, buf, count) : -EIO; } static const struct sysfs_ops threshold_ops = {