From patchwork Mon Jan 15 03:56:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li zeming X-Patchwork-Id: 188014 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1486656dyc; Sun, 14 Jan 2024 19:56:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHU/wpvaqClRN9VtqE/hgwzlcMajOIzfLGndByOwqQ2oHl22/8wkn8bk2yuHGBtdQvfJsHx X-Received: by 2002:a0c:f18e:0:b0:680:c83a:3601 with SMTP id m14-20020a0cf18e000000b00680c83a3601mr6021601qvl.9.1705291012047; Sun, 14 Jan 2024 19:56:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705291012; cv=none; d=google.com; s=arc-20160816; b=qAzXop1tPDTEE9fL/6UUOKeAc9BNRObr6a3oN7/PBRUcG0NDkF+ARbJTqYFW9WQ6pg Qxw0877X/0nwOpLOxpd1xaEDkJbiHzd+O0K+NgvcRFesr2savC6tacAjqDdQV2sM9+Mb GoEp4pJAdpDW9oI6lbqAE/rjNhqK5xlUGn1/YpB3aH36ME3fDcrbYo7wMYBBOgbKcRFt hkw9/boN0BW00mK9XZy/njvMTQD7NIIczmGRBX62ypmZETvMWsJo7raIKVfaz01vow0U RF/sHmcCot5BYA7Xcoo2F+uGAs7Gb9EKaDtN9WQ7bjBTDH8ZBZdhua/xtddwVKpmD3P2 iw5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from; bh=srK+ezPNvvfdBiDpCQLcL9w4mZG2Cg9icrzRFkXFW1g=; fh=7yu4c+Y5M7IxEQ4qmc5Q5gLDMN9xnC91lFTUwZ+nzgY=; b=hrwgqBys1FH43tae1TfEJfdFrboiV/Bu37zjYlph+8zBtdhgOzp7lMRfwUlwYieTDv 5cjctmEIygnC5MAcyl0tbmYclYfKAmvh+Zf4+JFE365os217z2QMZpd1CbS+XNoorkN4 f3FpuKmREXDFMjC6o0LrIumzoL1gI0iN1vK/fIZ81X85KpdLKkIH/4g4FzNMUTYskkp3 bRedR8bnlqiamIFzWiohUOEzNe/yptQTi8k7g5auNJPNifZdgT2LFINrX06b4S59pwPU 9mkF9jlIooRrQiNlE1csU9+dTsey/bwYyfrs6MXil/UskSybMOe/kvBMzNJk7Qy/v8+C HLfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25611-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25611-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b17-20020a0cf051000000b00680607ae946si7306918qvl.160.2024.01.14.19.56.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 19:56:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25611-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25611-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25611-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D52B51C20CED for ; Mon, 15 Jan 2024 03:56:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 973233D8E; Mon, 15 Jan 2024 03:56:30 +0000 (UTC) Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id 2C63920F4; Mon, 15 Jan 2024 03:56:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from localhost.localdomain (unknown [219.141.250.2]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 161F46019B694; Mon, 15 Jan 2024 11:56:18 +0800 (CST) X-MD-Sfrom: zeming@nfschina.com X-MD-SrcIP: 219.141.250.2 From: Li zeming To: mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Li zeming Subject: [PATCH] proc: proc_sysctl: Optimize proc_sys_fill_cache() variable Date: Mon, 15 Jan 2024 11:56:14 +0800 Message-Id: <20240115035614.26187-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788127227994804170 X-GMAIL-MSGID: 1788127227994804170 The ino and type variables are assigned values before use, and they do not need to be assigned values when defined. Signed-off-by: Li zeming --- fs/proc/proc_sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index c88854df0b624..cdda684551599 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -683,8 +683,8 @@ static bool proc_sys_fill_cache(struct file *file, struct dentry *child, *dir = file->f_path.dentry; struct inode *inode; struct qstr qname; - ino_t ino = 0; - unsigned type = DT_UNKNOWN; + ino_t ino; + unsigned type; qname.name = table->procname; qname.len = strlen(table->procname);