Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751821AbdIUGXe (ORCPT ); Thu, 21 Sep 2017 02:23:34 -0400 Received: from www17.your-server.de ([213.133.104.17]:59859 "EHLO www17.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751652AbdIUGX3 (ORCPT ); Thu, 21 Sep 2017 02:23:29 -0400 Subject: [PATCH 1/6] mailbox: bcm-flexrm-mailbox: Cocci spatch "pool_zalloc-simple" From: Thomas Meyer To: jassisinghbrar@gmail.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Message-ID: <1505974468535-1383415532-1-diffsplit-thomas@m3y3r.de> References: <1505974468535-2047238743-0-diffsplit-thomas@m3y3r.de> In-Reply-To: <1505974468535-2047238743-0-diffsplit-thomas@m3y3r.de> Date: Thu, 21 Sep 2017 08:15:26 +0200 X-Mailer: Evolution 3.22.6-1 Content-Transfer-Encoding: 7bit X-Authenticated-Sender: thomas@m3y3r.de Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 912 Lines: 26 Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0. Found by coccinelle spatch "api/alloc/pool_zalloc-simple.cocci" Signed-off-by: Thomas Meyer --- diff -u -p a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -1258,14 +1258,13 @@ static int flexrm_startup(struct mbox_ch } /* Allocate completion memory */ - ring->cmpl_base = dma_pool_alloc(ring->mbox->cmpl_pool, - GFP_KERNEL, &ring->cmpl_dma_base); + ring->cmpl_base = dma_pool_zalloc(ring->mbox->cmpl_pool, GFP_KERNEL, + &ring->cmpl_dma_base); if (!ring->cmpl_base) { dev_err(ring->mbox->dev, "can't allocate completion memory\n"); ret = -ENOMEM; goto fail_free_bd_memory; } - memset(ring->cmpl_base, 0, RING_CMPL_SIZE); /* Request IRQ */ if (ring->irq == UINT_MAX) {