Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3128743pxb; Sun, 26 Sep 2021 06:09:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxEughbNdrGIbrkfZ96bdg8Pzse84d0LH7Y/6k9690kHiAIJr5Ldc4sv6Ot/fbymTQgAd5 X-Received: by 2002:a17:906:9241:: with SMTP id c1mr22859618ejx.125.1632661750562; Sun, 26 Sep 2021 06:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632661750; cv=none; d=google.com; s=arc-20160816; b=b/My9pHV+csf+L/B6plgFUbxFna+/jSH++z+nacH7yqtMvbTs7bXZzBxQC/pQU0iPR hlyRlexaxmcaQ9WOkW1tf+7uvgxmu248Rbk33OWh4Y45mlR8tR3R8tCa1xRe42l2kOZC BFuasX8C/H8bVdkBwT0yMdN8w6z3ACixAGNED/RZT8QTDcUxXoNcI5D1H6mjbLQRo7n6 XyHPgDESPpJ5polNJyepOudlISHXngF7EnmGdZpfTkPbJ32aeIkchXnMysu3G7x0o05M vw764wAC34KED/hZD6LuCn4EbvV41WEETGXUbTEojtQ2swgooHKeIFzJlcORoNxhUN7f Sgvw== 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 :message-id:date:subject:cc:to:from; bh=cqCA23/m/4/IGbzFeOUw6JVThYONhQxp8OEaUOBLCVo=; b=gBU/hoRB5F1Azf07j1Kmt0IEdOWAp5i4NWEg75Z2CR4F7lKnjr9KFYYX76Rbbi9Sb9 2h/lQK36mFQhUTjjk0Z4w7D84CizGa62vVPov2uoULXnCE61c9kmb3z4j9MdjL1Jqrbb Tt02oU+74tIaps6a6PhulWcJbjwa6T6D6cSsAY2j4waQK5k7wZRLzAWqyBX70Wm7ztb6 pBPiQGwzA1ATFFek/dQTQEqN5fYcF5jo7MdPStCIGQMqTgpQBipYz77mn11snTS9r1Na 689IXQYhP5rPKmylHiORREjhS6j52NosYNiYbMpe7aoS70Ml9QDtZfGTN6dKE/anAPo0 1zxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si20704274edj.100.2021.09.26.06.08.47; Sun, 26 Sep 2021 06:09:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231685AbhIZNJB (ORCPT + 99 others); Sun, 26 Sep 2021 09:09:01 -0400 Received: from smtp09.smtpout.orange.fr ([80.12.242.131]:53325 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231671AbhIZNJA (ORCPT ); Sun, 26 Sep 2021 09:09:00 -0400 Received: from pop-os.home ([90.126.248.220]) by mwinf5d33 with ME id yd7K2500H4m3Hzu03d7Lw8; Sun, 26 Sep 2021 15:07:22 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 26 Sep 2021 15:07:22 +0200 X-ME-IP: 90.126.248.220 From: Christophe JAILLET To: thierry.reding@gmail.com, vdumpa@nvidia.com, joro@8bytes.org, will@kernel.org, jonathanh@nvidia.com Cc: linux-tegra@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable Date: Sun, 26 Sep 2021 15:07:18 +0200 Message-Id: <2c0f4da80c3b5ef83299c651f69a563034c1c6cb.1632661557.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'smmu->asids' is a bitmap. So use 'devm_kzalloc()' to simplify code, improve the semantic of the code and avoid some open-coded arithmetic in allocator arguments. Signed-off-by: Christophe JAILLET --- drivers/iommu/tegra-smmu.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 0a281833f611..e900e3c46903 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -1079,7 +1079,6 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev, struct tegra_mc *mc) { struct tegra_smmu *smmu; - size_t size; u32 value; int err; @@ -1097,9 +1096,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev, */ mc->smmu = smmu; - size = BITS_TO_LONGS(soc->num_asids) * sizeof(long); - - smmu->asids = devm_kzalloc(dev, size, GFP_KERNEL); + smmu->asids = devm_bitmap_zalloc(dev, soc->num_asids, GFP_KERNEL); if (!smmu->asids) return ERR_PTR(-ENOMEM); -- 2.30.2