Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1986003imm; Sat, 18 Aug 2018 08:30:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxRPe1c/j9NmzTrR+1owdQuj1odD04wkvnP5VEVXsAIa4wBGmFW0hh245Xd9hMnUzIevHjL X-Received: by 2002:a63:ce12:: with SMTP id y18-v6mr36974262pgf.144.1534606227188; Sat, 18 Aug 2018 08:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534606227; cv=none; d=google.com; s=arc-20160816; b=c2LklGr9e7GlJY423Ub3DJvPkNm/XmqKkJLSZzgxKCKvY+3xrVVa6kThG9NMeNzNiT MlwQCaSYfHesIyZmdFgA6ONvQElKNcZQ2JP8VxdnxK11V7zOno9R3wV4vf6y8qFYnV6a d01dps4W8I3ZAG+n5IR/sk16CRiXdrxZObEyCm8T2wzbpq9qweZOZFsuCYiJN+/JGZXL droaDrSwixY7LtNY73OFow4+lj52qRwEO1RF9INB8P8wT7h1js3NaNcckkp71lnIO3jG VZl5wJKzPt/8MF4hYO+8cFmw1inWmZmm2JCTelB5/ykgwwZpyYdm4k6G7ZD9W6LtSCQf Z+cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=M8LLqG1LFkEZh+hcyaXOmWvdwTmnVtOr2YFwyKP+twM=; b=li7xT/JxyneSTfSzquDshlgp9Ejpf1RzIv4bf/+n2HcILXsSNf/hl48QqGw9U6KWjl xNcP2pyjqOvnbYssbhGaagYJQU09VaFwtXdUrHIJDy/6NslqQDKxvUfOAt0SRz21XABa 9ZchdB1Rdw75538HGt3mm+CIyNyM2enIXWKBmtM8xkJg54ui92zcn1vFXQ56jDXxlnZc d6dPI8cvNKFzoESePUaX5YPBbvK7xoT9bMwZaA6OJ3ldmuqeC1B0p6vx6UOM7h+HYirV O9+D6rmAS9Xa6VZQ5jv7MrBF0+l/7BDp4X2UG0A9vw+eYuR85WtPDlE0jz+rgNFd6wyK bWYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7-v6si4803469plk.254.2018.08.18.08.30.08; Sat, 18 Aug 2018 08:30:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726308AbeHRSg5 (ORCPT + 99 others); Sat, 18 Aug 2018 14:36:57 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11176 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726230AbeHRSg4 (ORCPT ); Sat, 18 Aug 2018 14:36:56 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 85C7C19C64D25; Sat, 18 Aug 2018 23:28:48 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Sat, 18 Aug 2018 23:28:48 +0800 From: zhong jiang To: , , , , CC: , , , Subject: [PATCH 2/2] media: mtk_vcodec_util: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset Date: Sat, 18 Aug 2018 23:16:55 +0800 Message-ID: <1534605415-11452-3-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1534605415-11452-1-git-send-email-zhongjiang@huawei.com> References: <1534605415-11452-1-git-send-email-zhongjiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dma_zalloc_coherent has implemented the dma_alloc_coherent() + memset(), We prefer to dma_zalloc_coherent instead of open-codeing. Signed-off-by: zhong jiang --- drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c index 0c28d0b..e80123c 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c @@ -49,16 +49,13 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data, struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; struct device *dev = &ctx->dev->plat_dev->dev; - mem->va = dma_alloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL); - + mem->va = dma_zalloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL); if (!mem->va) { mtk_v4l2_err("%s dma_alloc size=%ld failed!", dev_name(dev), size); return -ENOMEM; } - memset(mem->va, 0, size); - mtk_v4l2_debug(3, "[%d] - va = %p", ctx->id, mem->va); mtk_v4l2_debug(3, "[%d] - dma = 0x%lx", ctx->id, (unsigned long)mem->dma_addr); -- 1.7.12.4