From patchwork Thu Aug 30 10:32:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10581455 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1B41E14BD for ; Thu, 30 Aug 2018 10:32:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B817279E0 for ; Thu, 30 Aug 2018 10:32:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3A5327FB3; Thu, 30 Aug 2018 10:32:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7E2726E7B for ; Thu, 30 Aug 2018 10:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728306AbeH3OeV (ORCPT ); Thu, 30 Aug 2018 10:34:21 -0400 Received: from mga12.intel.com ([192.55.52.136]:63519 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728138AbeH3OeV (ORCPT ); Thu, 30 Aug 2018 10:34:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2018 03:32:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,306,1531810800"; d="scan'208";a="258463453" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 30 Aug 2018 03:32:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B9A0914F; Thu, 30 Aug 2018 13:32:36 +0300 (EEST) From: Andy Shevchenko To: Bjorn Helgaas , linux-pci@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1] PCI: Switch to bitmap_zalloc() Date: Thu, 30 Aug 2018 13:32:36 +0300 Message-Id: <20180830103236.60736-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.18.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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/pci/pci.c | 3 +-- drivers/pci/probe.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 29ff9619b5fa..c6de7e0dd3fa 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5689,8 +5689,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode, void pci_add_dma_alias(struct pci_dev *dev, u8 devfn) { if (!dev->dma_alias_mask) - dev->dma_alias_mask = kcalloc(BITS_TO_LONGS(U8_MAX), - sizeof(long), GFP_KERNEL); + dev->dma_alias_mask = bitmap_zalloc(U8_MAX, GFP_KERNEL); if (!dev->dma_alias_mask) { pci_warn(dev, "Unable to allocate DMA alias mask\n"); return; diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index ec784009a36b..b6465a59aeb1 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2140,7 +2140,7 @@ static void pci_release_dev(struct device *dev) pcibios_release_device(pci_dev); pci_bus_put(pci_dev->bus); kfree(pci_dev->driver_override); - kfree(pci_dev->dma_alias_mask); + bitmap_free(pci_dev->dma_alias_mask); kfree(pci_dev); }