Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3482730rdb; Wed, 13 Sep 2023 13:29:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGR1TpbxyN/AvwxasHSTmCfcEii6ovmL01f6DaMp9OrM3EYgIZV8oLx0+NhNN3YSOC3ZkFy X-Received: by 2002:a17:90a:420b:b0:263:829:2de with SMTP id o11-20020a17090a420b00b00263082902demr3301844pjg.2.1694636950914; Wed, 13 Sep 2023 13:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694636950; cv=none; d=google.com; s=arc-20160816; b=rUG96aNpXMsmmwHniYzSU13j1genDvo55VUYunxg+dPiYbWL675r/XnJ35da6FSUxn GZKAW1OC5Rs9QQwAg6SYKs7IWPjZSo1TWGfzKn0carwUHMIVQ3vAeIYnCJ/rzIs2jMxI hfw4DO+OKoNDE3RNW1FbZ5dkSW9WlnIE/5JhjqMBWDs8UBgRFqxLE6361RglSB9zKv+y ZQcQpZm5xAOLiP2XkTYfeUodiwrF0N/hM7bISiKcZ8Ud6QWN0OlvlRpF+ZpIgClJO4ib Q0b+jBo4r/oU7w68pZEa+CS0bl9BLWiQCTxCh/XAHH9xk5e75TMVfQWculIzcJTOJ+V7 lHYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hlykGlfL2an/VgWBLR95t+wE6CpOLlFaVT0cHbSVLN0=; fh=nfQSbTp1dWHt2Ier1Up8UhVNdXOqoJJLNvTrpT3jJEk=; b=YlflyAk6n32t53xzN47UEDJhwSFMjx/Oy5VUczHXxTDztLDdzv+ftawZXaR6q1tQ+Q 1rfpJ0mAuqTgnpVwHzvI451n9IunT/0PkbOujP9JIpbE7n+B+gBvFC9kFAHtoyd25YtG Q+MJ6g8FRc0Dr7zcSyGKH/h6jypYx9WECGRJZCHz5jdpbvScqBFDgOl1Fjetl4lLGWT/ WuqeeTzEW41g/ip0heEN8mBKDvc2DdQP3pdXOSNnDS/1Mn/KhHBb5ejQrsziU2pfCNFh 8rtsmueTmp+ouYx5IW3Edt7l16vyMKh4PDXwDFacer4IKZL0KNgpj1AX5+1eDlFZGIHg CMhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pRcWYiA4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id v7-20020a17090a088700b002741437d773si2264492pjc.176.2023.09.13.13.29.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 13:29:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=pRcWYiA4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B2CF38113410; Wed, 13 Sep 2023 10:15:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231435AbjIMRPL (ORCPT + 99 others); Wed, 13 Sep 2023 13:15:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbjIMRO7 (ORCPT ); Wed, 13 Sep 2023 13:14:59 -0400 Received: from out-228.mta0.migadu.com (out-228.mta0.migadu.com [91.218.175.228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A725F19B1 for ; Wed, 13 Sep 2023 10:14:54 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1694625289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hlykGlfL2an/VgWBLR95t+wE6CpOLlFaVT0cHbSVLN0=; b=pRcWYiA4V9DcqOTdN2gLjPxezJ2SlGOHPh1Fz59jRDjJpcStfHaMZtV5oUBDvkHZp9pcN1 2sU42kzOkV4/EmNirmCx2z3pluIo9R1jBj4CZupNvF1dF6+hUeuhGaZZv4dXI+nj7Z61iS xPrZS4MeqQS5+CE7Icb238Gz0TxGYDs= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v2 02/19] lib/stackdepot: simplify __stack_depot_save Date: Wed, 13 Sep 2023 19:14:27 +0200 Message-Id: <3336cf19b8e53ed5449550a085cff9bddec4c873.1694625260.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 13 Sep 2023 10:15:25 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email From: Andrey Konovalov The retval local variable in __stack_depot_save has the union type handle_parts, but the function never uses anything but the union's handle field. Define retval simply as depot_stack_handle_t to simplify the code. Reviewed-by: Alexander Potapenko Signed-off-by: Andrey Konovalov --- lib/stackdepot.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 3a945c7206f3..0772125efe8a 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -360,7 +360,7 @@ depot_stack_handle_t __stack_depot_save(unsigned long *entries, gfp_t alloc_flags, bool can_alloc) { struct stack_record *found = NULL, **bucket; - union handle_parts retval = { .handle = 0 }; + depot_stack_handle_t handle = 0; struct page *page = NULL; void *prealloc = NULL; unsigned long flags; @@ -377,7 +377,7 @@ depot_stack_handle_t __stack_depot_save(unsigned long *entries, nr_entries = filter_irq_stacks(entries, nr_entries); if (unlikely(nr_entries == 0) || stack_depot_disabled) - goto fast_exit; + return 0; hash = hash_stack(entries, nr_entries); bucket = &stack_table[hash & stack_hash_mask]; @@ -443,9 +443,8 @@ depot_stack_handle_t __stack_depot_save(unsigned long *entries, free_pages((unsigned long)prealloc, DEPOT_POOL_ORDER); } if (found) - retval.handle = found->handle.handle; -fast_exit: - return retval.handle; + handle = found->handle.handle; + return handle; } EXPORT_SYMBOL_GPL(__stack_depot_save); -- 2.25.1