From patchwork Wed Jan 7 09:27:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kurtz X-Patchwork-Id: 5583331 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2FAD4BF6C3 for ; Wed, 7 Jan 2015 09:27:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCF80201F4 for ; Wed, 7 Jan 2015 09:27:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CF7C3201EF for ; Wed, 7 Jan 2015 09:27:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 294136E5AD; Wed, 7 Jan 2015 01:27:46 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by gabe.freedesktop.org (Postfix) with ESMTP id 4BD3E6E5AD for ; Wed, 7 Jan 2015 01:27:45 -0800 (PST) Received: by mail-pd0-f182.google.com with SMTP id p10so3519144pdj.13 for ; Wed, 07 Jan 2015 01:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=LEnDxKOiuldy88ThfuO9/d4S+GXwrWqhlQInLibJFpg=; b=looMHUyyDGglnUwNPaWx36CuHchRX+ca8LoTkgNVc6w/8rt/u/OmIl90Wl43Syv8Qe fc7nuw6WGkP7phQgGh0Kwo+7Q/SLVcseXLsbWDTJsuGm6ohibA4VzJYq0NInIrqGjNY7 2eKeBafwTqdzx65aLOfboy3CNhnHk9CziZ38k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LEnDxKOiuldy88ThfuO9/d4S+GXwrWqhlQInLibJFpg=; b=DbxLWJSgjZBcAohW7dduMcMcCJhLLcLBpUCW1YuGXigdb8/axA8BzYdheDtO3msEoD ffLk6zQH29jIBOdNmffQb9nQbpKvztObCrOQyQCEQhQDKoTdWTwn9xbn+ZTNBKqXteG9 yBhNU9HCVVSJOPw8SAXdQZGqFgrpd8nisoaddOdRV+RitI8OcdFUDsDwzjtQP90T5fpF UZ2GxwdprZy+Wr7lTAJZ1CH2XagVE267pbrDQsDeMt6l4+8cr2IuDZ5N17K9BwBid++b pBVJ6IZBMkux/Ey96ShiLzivO5ookwzr/R2NQ5saVPAhmfPMVY34duNxeDUf4QRL7mUj 7xcw== X-Gm-Message-State: ALoCoQkmUejXMo4Mznsifl+SGllGQZ55aXAn16sU8g7BByyndx25VHOonRtgPkIQdTAGJ4Zt9Hrz X-Received: by 10.66.141.42 with SMTP id rl10mr3689428pab.100.1420622864732; Wed, 07 Jan 2015 01:27:44 -0800 (PST) Received: from djkurtz1.tpe.corp.google.com ([172.30.210.4]) by mx.google.com with ESMTPSA id v4sm1241509pdj.22.2015.01.07.01.27.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jan 2015 01:27:43 -0800 (PST) From: Daniel Kurtz To: Mark Yao Subject: [PATCH] drm/rockchip: fix dma_alloc_attrs() error check Date: Wed, 7 Jan 2015 17:27:06 +0800 Message-Id: <1420622830-8608-1-git-send-email-djkurtz@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c Cc: open list , linux-rockchip@lists.infradead.org, "open list:DRM DRIVERS" , Pawel Osciak 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-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dma_alloc_attrs() returns NULL if it cannot allocate a dma buffer (or mapping), not a negative error code. Rerported-by: Pawel Osciak Signed-off-by: Daniel Kurtz --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index bc98a22..7ca8799e 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -34,12 +34,9 @@ static int rockchip_gem_alloc_buf(struct rockchip_gem_object *rk_obj) rk_obj->kvaddr = dma_alloc_attrs(drm->dev, obj->size, &rk_obj->dma_addr, GFP_KERNEL, &rk_obj->dma_attrs); - if (IS_ERR(rk_obj->kvaddr)) { - int ret = PTR_ERR(rk_obj->kvaddr); - - DRM_ERROR("failed to allocate %#x byte dma buffer, %d", - obj->size, ret); - return ret; + if (!rk_obj->kvaddr) { + DRM_ERROR("failed to allocate %#x byte dma buffer", obj->size); + return -ENOMEM; } return 0;