From nobody Sun Dec 14 06:34:43 2025 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 D26D1C83F1D for ; Tue, 29 Aug 2023 17:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237663AbjH2RMM (ORCPT ); Tue, 29 Aug 2023 13:12:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237640AbjH2RLm (ORCPT ); Tue, 29 Aug 2023 13:11:42 -0400 Received: from out-245.mta1.migadu.com (out-245.mta1.migadu.com [95.215.58.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D31581B9 for ; Tue, 29 Aug 2023 10:11:37 -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=1693329096; 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=Opt9t2Sh3BPQLxjav3raWw4j3L9ASrpPJpFprr4WIwg=; b=FMOUlvJxgMB5WpKRQ7t3KX2aGQnwsNKzQ2ccI31MOspuXDov1WZjg8f3zBxS9aiip16KLg QsPLydt7gf0VxZWrz0MHedBxpNNjUHO1AeoE3D3p5RwVNU7SOLfTAhOveTf+35NDZNtujl ResgGbrFAGlj6khMSxwabRc53OkvSPc= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH 02/15] stackdepot: simplify __stack_depot_save Date: Tue, 29 Aug 2023 19:11:12 +0200 Message-Id: <20dbc3376fccf2e7824482f56a75d6670bccd8ff.1693328501.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko --- 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 =3D NULL, **bucket; - union handle_parts retval =3D { .handle =3D 0 }; + depot_stack_handle_t handle =3D 0; struct page *page =3D NULL; void *prealloc =3D NULL; unsigned long flags; @@ -377,7 +377,7 @@ depot_stack_handle_t __stack_depot_save(unsigned long *= entries, nr_entries =3D filter_irq_stacks(entries, nr_entries); =20 if (unlikely(nr_entries =3D=3D 0) || stack_depot_disabled) - goto fast_exit; + return 0; =20 hash =3D hash_stack(entries, nr_entries); bucket =3D &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 =3D found->handle.handle; -fast_exit: - return retval.handle; + handle =3D found->handle.handle; + return handle; } EXPORT_SYMBOL_GPL(__stack_depot_save); =20 --=20 2.25.1