From nobody Tue Sep 16 14:32:58 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 3B591C3DA7D for ; Tue, 3 Jan 2023 19:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238905AbjACTTz (ORCPT ); Tue, 3 Jan 2023 14:19:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234088AbjACTTB (ORCPT ); Tue, 3 Jan 2023 14:19:01 -0500 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 940CA15F3F for ; Tue, 3 Jan 2023 11:16:24 -0800 (PST) Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 303IGC14030763 for ; Tue, 3 Jan 2023 11:16:24 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=4vF82BWEqxBKkQknzp3N1SGxBDFI+587r5lj6iGRioE=; b=W7drp1G31q2A8YZXGiuHPW15tyy8FmzSChFaIlpYEPSTwiUgnKKEYYGO4bM7BjVNVj4N TY30UuhiwqRZmR3Yl+43quKXJC+j1M6Hqr8aga6uRYM+5MmMRSKwEoPt6N15R3zzWCwE GObl7RUpLHxm989ZWdK8WWXOo0GG64GbFsL+yvYjtjq+VPosePoZtB1axDB5kb0nGGhM q5zbuav5cwz2wmNWyTDZXPTtKQRuugNRngNlz7dwlzcdbGdm7y48Atn/Ve83egwcX2oY Gc/ilIip37gg8tK+C1ENyS47b5XZ6Wc5S4t23evmBL7rvHLHtDu62Bm/RfSXI05lSI0G Rw== Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3mth9wetxa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 03 Jan 2023 11:16:24 -0800 Received: from twshared41876.03.ash8.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 3 Jan 2023 11:16:22 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 6D499E1F5E20; Tue, 3 Jan 2023 11:15:55 -0800 (PST) From: Keith Busch To: , , Matthew Wilcox , Christoph Hellwig CC: Tony Battersby , Kernel Team , Keith Busch Subject: [PATCHv3 12/12] dmapool: create/destroy cleanup Date: Tue, 3 Jan 2023 11:15:51 -0800 Message-ID: <20230103191551.3254778-13-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230103191551.3254778-1-kbusch@meta.com> References: <20230103191551.3254778-1-kbusch@meta.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: aQ59oVMoP8cqI78E6h-erikVlib-GnL2 X-Proofpoint-GUID: aQ59oVMoP8cqI78E6h-erikVlib-GnL2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-03_07,2023-01-03_02,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch Set the 'empty' bool directly from the result of the function that determines its value instead of adding indirection logic. Signed-off-by: Keith Busch Reviewed-by: Christoph Hellwig --- mm/dmapool.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/dmapool.c b/mm/dmapool.c index d23747a71bff2..db4de646a3a91 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -138,7 +138,7 @@ struct dma_pool *dma_pool_create(const char *name, stru= ct device *dev, { struct dma_pool *retval; size_t allocation; - bool empty =3D false; + bool empty; =20 if (!dev) return NULL; @@ -188,8 +188,7 @@ struct dma_pool *dma_pool_create(const char *name, stru= ct device *dev, */ mutex_lock(&pools_reg_lock); mutex_lock(&pools_lock); - if (list_empty(&dev->dma_pools)) - empty =3D true; + empty =3D list_empty(&dev->dma_pools); list_add(&retval->pools, &dev->dma_pools); mutex_unlock(&pools_lock); if (empty) { @@ -263,7 +262,7 @@ static struct dma_page *pool_alloc_page(struct dma_pool= *pool, gfp_t mem_flags) void dma_pool_destroy(struct dma_pool *pool) { struct dma_page *page, *tmp; - bool empty =3D false, busy =3D false; + bool empty, busy =3D false; =20 if (unlikely(!pool)) return; @@ -271,8 +270,7 @@ void dma_pool_destroy(struct dma_pool *pool) mutex_lock(&pools_reg_lock); mutex_lock(&pools_lock); list_del(&pool->pools); - if (list_empty(&pool->dev->dma_pools)) - empty =3D true; + empty =3D list_empty(&pool->dev->dma_pools); mutex_unlock(&pools_lock); if (empty) device_remove_file(pool->dev, &dev_attr_pools); --=20 2.30.2