From patchwork Tue Nov 22 21:56:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13052784 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A076C433FE for ; Tue, 22 Nov 2022 21:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=O/goIBAg9AIKKwUOuT4TghNDp9wKc6En3G9MWWGYPuU=; b=1bZ4NX/potGMPs 6m0AF/NW7XfqMgSG1ISwZ8e/IYNeCG3LiGepVDxdcr5foF6/4q0rL+o6246ug3UU+ULMBR0nK/A0v aoweceC69ZQU2DVtOBZblJ+YFN4V7LlUHxW83hwkHD4ASCd9MHu5LVmcUWBPxUuXPmGsEehW+6ms8 PUz1L8yNVvrdXWgAL+AwqxCiuS/2S/hB9wl+mxmS+haSnLbM7d1AI6Rn1Ut/v8U1iqld6Aa5yggCu /2ncAadPv2wvBErVxznGYq0PezoMpR5dKg6yOF7qDLHUAr1Wz1bmHxUQXRA1CrDLj2PUJPqAcQ2P/ MgWkO2jmDTMiSraFZttw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxbFu-00C42W-5s; Tue, 22 Nov 2022 21:56:38 +0000 Received: from smtp-19.smtpout.orange.fr ([80.12.242.19] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxbFp-00C40L-NI for linux-amlogic@lists.infradead.org; Tue, 22 Nov 2022 21:56:36 +0000 Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id xbFdoaYQDOAzAxbFdon0TP; Tue, 22 Nov 2022 22:56:26 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 22 Nov 2022 22:56:26 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Corentin Labbe , Herbert Xu , "David S. Miller" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-crypto@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH] crypto: amlogic - Save a few bytes of memory Date: Tue, 22 Nov 2022 22:56:19 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221122_135633_918992_49BA1239 X-CRM114-Status: GOOD ( 12.56 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org There is no real point in allocating dedicated memory for the irqs array. MAXFLOW is only 2, so it is easier to allocated the needed space directly within the 'meson_dev' structure. This saves some memory allocation and avoids an indirection when using the irqs array. Signed-off-by: Christophe JAILLET --- drivers/crypto/amlogic/amlogic-gxl-core.c | 1 - drivers/crypto/amlogic/amlogic-gxl.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c index 6e7ae896717c..937187027ad5 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-core.c +++ b/drivers/crypto/amlogic/amlogic-gxl-core.c @@ -237,7 +237,6 @@ static int meson_crypto_probe(struct platform_device *pdev) return err; } - mc->irqs = devm_kcalloc(mc->dev, MAXFLOW, sizeof(int), GFP_KERNEL); for (i = 0; i < MAXFLOW; i++) { mc->irqs[i] = platform_get_irq(pdev, i); if (mc->irqs[i] < 0) diff --git a/drivers/crypto/amlogic/amlogic-gxl.h b/drivers/crypto/amlogic/amlogic-gxl.h index dc0f142324a3..8c0746a1d6d4 100644 --- a/drivers/crypto/amlogic/amlogic-gxl.h +++ b/drivers/crypto/amlogic/amlogic-gxl.h @@ -95,7 +95,7 @@ struct meson_dev { struct device *dev; struct meson_flow *chanlist; atomic_t flow; - int *irqs; + int irqs[MAXFLOW]; #ifdef CONFIG_CRYPTO_DEV_AMLOGIC_GXL_DEBUG struct dentry *dbgfs_dir; #endif