From patchwork Fri Jun 18 15:16:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12331611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C266EC49361 for ; Fri, 18 Jun 2021 15:18:55 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 921C5613E9 for ; Fri, 18 Jun 2021 15:18:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 921C5613E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:References:In-Reply-To: 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: List-Owner; bh=54HkHJ/HfUOPSMYKBn7oSX6xKvOo5TykrLyJkNZQ/H0=; b=v050j2G/q5xAKp nkd951ut1Fv3GTnvj+dw6RH5RuG+x2M0kY54Sl8i7C47Zsp99I0v/gs2prYnVKFza3Du/HxqXGd1q /+FW3lkTHZ2YvMBF15OsmcqRw2LNUEeD2xwaWXVXdYJP+DOpVdjMiH6yfNe24/kYu2dhDQJSSj7JO E/ShENbXFyKlRSISiTbe9vhZ6dTzabCvNembcwHdYcaqTZNH4v9zl1AoeyOHt6chYIDSVdSZGHXl8 G26FRoGo7zpwt1jKFm/i37nh2RjekQDuIzK7n3H/AQVoNe2qrE1GdCtYQWSUlNk6nHhswnD1e9Frc CpcVXHKt17y2bYbzm6gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1luGEu-00Ef7b-BQ; Fri, 18 Jun 2021 15:17:00 +0000 Received: from mga06.intel.com ([134.134.136.31]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1luGEi-00Ef37-C6 for linux-arm-kernel@lists.infradead.org; Fri, 18 Jun 2021 15:16:49 +0000 IronPort-SDR: zMVxy1VUJAmqHPZkrFag6H5pgf+q3EBizf5nBbJxW3uyoBUh4bMXfq4qNRc7A3PJcpgScfNhJv 5j9zS6osH11Q== X-IronPort-AV: E=McAfee;i="6200,9189,10019"; a="267713574" X-IronPort-AV: E=Sophos;i="5.83,284,1616482800"; d="scan'208";a="267713574" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2021 08:16:45 -0700 IronPort-SDR: bUWn2aZ+KSWpqGLPniPUe4ytW8LWunC0LMYg7GeZzOY+uZJ6s1xAlopJsW03gj+ZFxbdxB1zFN JAUSB3pDdGQA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,284,1616482800"; d="scan'208";a="451423868" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 18 Jun 2021 08:16:43 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EBEA450E; Fri, 18 Jun 2021 18:17:07 +0300 (EEST) From: Andy Shevchenko To: Marc Zyngier , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tsahee Zidenberg , Antoine Tenart , Thomas Gleixner , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth Subject: [PATCH v1 4/7] irqchip/gic-v3: Switch to bitmap_zalloc() Date: Fri, 18 Jun 2021 18:16:54 +0300 Message-Id: <20210618151657.65305-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210618151657.65305-1-andriy.shevchenko@linux.intel.com> References: <20210618151657.65305-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210618_081648_473837_4C6AFE2E X-CRM114-Status: GOOD ( 12.37 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Switch to bitmap_zalloc() to show clearly what we are allocating. Besides that it returns pointer of bitmap type instead of opaque void *. Signed-off-by: Andy Shevchenko --- drivers/irqchip/irq-gic-v3-its.c | 9 ++++----- drivers/irqchip/irq-gic-v3-mbi.c | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index ba39668c3e08..daa5b1c968f0 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2140,7 +2140,7 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids) if (err) goto out; - bitmap = kcalloc(BITS_TO_LONGS(nr_irqs), sizeof (long), GFP_ATOMIC); + bitmap = bitmap_zalloc(nr_irqs, GFP_ATOMIC); if (!bitmap) goto out; @@ -2156,7 +2156,7 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids) static void its_lpi_free(unsigned long *bitmap, u32 base, u32 nr_ids) { WARN_ON(free_lpi_range(base, nr_ids)); - kfree(bitmap); + bitmap_free(bitmap); } static void gic_reset_prop_table(void *va) @@ -3376,8 +3376,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, if (alloc_lpis) { lpi_map = its_lpi_alloc(nvecs, &lpi_base, &nr_lpis); if (lpi_map) - col_map = kcalloc(nr_lpis, sizeof(*col_map), - GFP_KERNEL); + col_map = kcalloc(nr_lpis, sizeof(*col_map), GFP_KERNEL); } else { col_map = kcalloc(nr_ites, sizeof(*col_map), GFP_KERNEL); nr_lpis = 0; @@ -3387,7 +3386,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id, if (!dev || !itt || !col_map || (!lpi_map && alloc_lpis)) { kfree(dev); kfree(itt); - kfree(lpi_map); + bitmap_free(lpi_map); kfree(col_map); return NULL; } diff --git a/drivers/irqchip/irq-gic-v3-mbi.c b/drivers/irqchip/irq-gic-v3-mbi.c index e81e89a81cb5..b84c9c2eccdc 100644 --- a/drivers/irqchip/irq-gic-v3-mbi.c +++ b/drivers/irqchip/irq-gic-v3-mbi.c @@ -290,8 +290,7 @@ int __init mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent) if (ret) goto err_free_mbi; - mbi_ranges[n].bm = kcalloc(BITS_TO_LONGS(mbi_ranges[n].nr_spis), - sizeof(long), GFP_KERNEL); + mbi_ranges[n].bm = bitmap_zalloc(mbi_ranges[n].nr_spis, GFP_KERNEL); if (!mbi_ranges[n].bm) { ret = -ENOMEM; goto err_free_mbi; @@ -329,7 +328,7 @@ int __init mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent) err_free_mbi: if (mbi_ranges) { for (n = 0; n < mbi_range_nr; n++) - kfree(mbi_ranges[n].bm); + bitmap_free(mbi_ranges[n].bm); kfree(mbi_ranges); }