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: 5583351 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 49CEF9F357 for ; Wed, 7 Jan 2015 09:28:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E45A201F4 for ; Wed, 7 Jan 2015 09:28:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FB58201EF for ; Wed, 7 Jan 2015 09:28:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y8muR-0002eE-5f; Wed, 07 Jan 2015 09:28:11 +0000 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Y8muN-0002Hu-9D for linux-rockchip@lists.infradead.org; Wed, 07 Jan 2015 09:28:08 +0000 Received: by mail-pa0-f50.google.com with SMTP id bj1so3703565pad.9 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=itPrma7Mzt42o5khBgLHiqnwUfu9sVdjv3hvygNwXkA3T67oFzW6x9cGylEUcbfKCa Kv3e/7HXdob56kJqRjo3io2tVM0HkUhDO4TBTeqIV49daxFD9Tu2LiDtn7D3c4SFDyvQ 3EnaYlAUb+F3iMHKwdryuWLFl4BdIALqZiCi0At2qUj5vuUC0iiLFAes+JIa90Y7tg5t 26mDReTxGA2Y/fy+kHNe9To4Y/D1WJewYLuVwelPsCSP8KIVYaDrSb4iqDV+WcBZj0L2 h9N0pDGx1FQnHLGsOWWN52qTaYlEqb1ncISqI6JTfAboCK6tUQXry2WM0tu9apMAY14r Ml3g== X-Gm-Message-State: ALoCoQkZqsxWcfggN80JPkcqaGzWVgXOEalhTI4L7/WMGPeVpOtJkX1HROcFCyIG/JfBqfgsQiIy 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150107_012807_411180_EEA5A7BB X-CRM114-Status: UNSURE ( 8.31 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) Cc: David Airlie , open list , Daniel Kurtz , linux-rockchip@lists.infradead.org, Rob Clark , "open list:DRM DRIVERS" , Daniel Vetter , Pawel Osciak X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org 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=ham 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;