From patchwork Wed Oct 4 13:08:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 9984555 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 0002D60237 for ; Wed, 4 Oct 2017 13:08:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E024D28AEC for ; Wed, 4 Oct 2017 13:08:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4FF328AEF; Wed, 4 Oct 2017 13:08:45 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58CF428AEC for ; Wed, 4 Oct 2017 13:08:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A21A46E6C3; Wed, 4 Oct 2017 13:08:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id B2D106E6C3 for ; Wed, 4 Oct 2017 13:08:43 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 90656208A7; Wed, 4 Oct 2017 15:08:41 +0200 (CEST) Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 5CA74207F8; Wed, 4 Oct 2017 15:08:41 +0200 (CEST) From: Boris Brezillon To: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH] drm/gem-cma-helper: Change the level of the allocation failure message Date: Wed, 4 Oct 2017 15:08:39 +0200 Message-Id: <20171004130839.20285-1-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 2.11.0 Cc: Boris Brezillon X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP drm_gem_cma_create() prints an error message when dma_alloc_wc() fails to allocate the amount of memory we requested. This can lead to annoying error messages when CMA is only one possible source of memory for the BO allocation. Turn this error message into a debug one and add a __must_check specifier to make sure all callers are checking the return value. Signed-off-by: Boris Brezillon Reviewed-by: Daniel Vetter Reviewed-by: Eric Engestrom --- Hello, This problem happens with the VC4 driver which can flush its internal cache if case of CMA allocation failures. We should only complain if the last CMA allocation fails (the one happening after all internal caches have been flushed). Regards, Boris --- drivers/gpu/drm/drm_gem_cma_helper.c | 4 ++-- include/drm/drm_gem_cma_helper.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 373e33f22be4..e96c95c4fd23 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -95,7 +95,7 @@ __drm_gem_cma_create(struct drm_device *drm, size_t size) * * Returns: * A struct drm_gem_cma_object * on success or an ERR_PTR()-encoded negative - * error code on failure. + * error code on failure. Callers must check the return value. */ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, size_t size) @@ -112,7 +112,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, cma_obj->vaddr = dma_alloc_wc(drm->dev, size, &cma_obj->paddr, GFP_KERNEL | __GFP_NOWARN); if (!cma_obj->vaddr) { - dev_err(drm->dev, "failed to allocate buffer with size %zu\n", + dev_dbg(drm->dev, "failed to allocate buffer with size %zu\n", size); ret = -ENOMEM; goto error; diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index 58a739bf15f1..1b7d938a31a0 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -77,8 +77,8 @@ int drm_gem_cma_dumb_create(struct drm_file *file_priv, int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma); /* allocate physical memory */ -struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, - size_t size); +struct drm_gem_cma_object * +__must_check drm_gem_cma_create(struct drm_device *drm, size_t size); extern const struct vm_operations_struct drm_gem_cma_vm_ops;