From patchwork Fri Mar 23 16:34:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10305121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D25D7600F6 for ; Fri, 23 Mar 2018 16:37:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C23A728E56 for ; Fri, 23 Mar 2018 16:37:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3DE028E6A; Fri, 23 Mar 2018 16:37:36 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2711228E56 for ; Fri, 23 Mar 2018 16:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=sgy/oq/+3E9nomgTxlW7tS7LLNLCXI9mzHg/A125jxc=; b=I/r12hhIW+jcOGmBNjAiXCWpRx gNOCiyWhR9dRf09/mjxdFjo6bfqpYbddvmow9YOBBM9axxRjYzWS+EijWBDA0mR66VsWigVhU2iKw cybwmSF60g6aWRatozywbGk6XafMcZHZeaOJUNf4/sUAJb6S9aobITCGchEKqnd1iPoocRjJkLgKi kinuzMX/6I6lSfXBm/LC9T6khvlbnv02kbsAXJ6kwt4ci1UevdKdWx/gDwa1xxq5p0mX1Ts0fAj4n tj7NGF0BWbfQyhlhFs2DqbwtZrqESSZy6517cQgI5aPl5wGBwdgT1BHFQP3Glj8mxMhO09EHkVUgT UwapKNvA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ezPh4-0006Tp-Gp; Fri, 23 Mar 2018 16:37:30 +0000 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ezPen-0003ss-5E for linux-arm-kernel@lists.infradead.org; Fri, 23 Mar 2018 16:35:23 +0000 Received: by mail-pl0-x241.google.com with SMTP id u11-v6so7764339plq.1 for ; Fri, 23 Mar 2018 09:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8a+2CNaXeAxl73qV9mKREYLkFBHIUoYQlPR+otQ5uao=; b=bsh2+MtBilBwnA1ToaOc1NZRboko42CA3UlM4h1EucTuxNmZC8sz+Bxw/hOEmUsj2s Fimra0WgPuXeJUDfU4Pv3aI7R7a7hV+QDfqzCJIpyUqc7+NH+6rRWRBjisKmfEx0D1BP U0zdK4nIMlCCT5Qzx/eM0d9eIaNQP1PHAaWt4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8a+2CNaXeAxl73qV9mKREYLkFBHIUoYQlPR+otQ5uao=; b=scnu/ud8HXL5oJfbRtVfLc8AwNgsQL/Ekz3r5Mw/WyydmxNfOI2hCe0j3UQEig+tVX xiYKXk78PE4K/AeH485sAwH4Xf5W+KsOQtkosTgAmqzgyRdeNB5q9g6GVupxJ0t3vsJ6 Twis5filDfeMkbhjwlnjPbV9CfZY0/77qo+8pIjsJkUgEOiAvUJz96HHs8Jzwcrdg/cK v+jvqJ4EVmZM+/WgOdJcDb5zrDennp0etNB38qzNB6iets/DsImSYpxBthht/1V4HC1m 4czFrd+lWWO+hgXrwqZDJ3NCnFLfD3k651lt67DZmtEK/3wBV5foxXIq354t6HomDEUj rJ7w== X-Gm-Message-State: AElRT7FvapGEDvYz8I8GCGMTtJP7BNBDEWkOXZXOW07BUjAcH4Hyjvj2 XSRGAhVb03EVZDMtJOULg21ltA== X-Google-Smtp-Source: AG47ELurtOVrGk7sIWRHsYTZMGGbEH/p1yKHR031w9AK255350OCRD2Yl/nNoEZ0ZRhSx74jH4P8NQ== X-Received: by 2002:a17:902:8602:: with SMTP id f2-v6mr29850263plo.6.1521822898638; Fri, 23 Mar 2018 09:34:58 -0700 (PDT) Received: from swboyd.mtv.corp.google.com ([2620:0:1000:1511:d30e:62c6:f82c:ff40]) by smtp.gmail.com with ESMTPSA id s78sm19131294pfa.161.2018.03.23.09.34.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 09:34:58 -0700 (PDT) From: Stephen Boyd To: Linus Walleij Subject: [PATCH v4 3/5] gpiolib: Change bitmap allocation to kmalloc_array Date: Fri, 23 Mar 2018 09:34:51 -0700 Message-Id: <20180323163453.96495-4-swboyd@chromium.org> X-Mailer: git-send-email 2.17.0.rc0.231.g781580f067-goog In-Reply-To: <20180323163453.96495-1-swboyd@chromium.org> References: <20180323163453.96495-1-swboyd@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180323_093509_844632_A5C2E593 X-CRM114-Status: GOOD ( 13.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Timur Tabi , linux-kernel@vger.kernel.org, Bjorn Andersson , Grant Likely , linux-gpio@vger.kernel.org, Andy Shevchenko , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We don't need to clear out these bits when we set them immediately after. Use kmalloc_array() to skip clearing the bits. Suggested-by: Andy Shevchenko Signed-off-by: Stephen Boyd --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index cc0e1519da45..db3788d17ba0 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -341,7 +341,7 @@ static unsigned long *gpiochip_allocate_mask(struct gpio_chip *chip) { unsigned long *p; - p = kcalloc(BITS_TO_LONGS(chip->ngpio), sizeof(long), GFP_KERNEL); + p = kmalloc_array(BITS_TO_LONGS(chip->ngpio), sizeof(*p), GFP_KERNEL); if (!p) return NULL;