From patchwork Tue Sep 10 22:56:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2871211 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C329A9F2D6 for ; Wed, 11 Sep 2013 08:02:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A29A3202EC for ; Wed, 11 Sep 2013 08:02:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 80C53202EA for ; Wed, 11 Sep 2013 08:02:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A11CE72B3 for ; Wed, 11 Sep 2013 01:02:06 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f48.google.com (mail-bk0-f48.google.com [209.85.214.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 11C7EE6294 for ; Tue, 10 Sep 2013 15:56:36 -0700 (PDT) Received: by mail-bk0-f48.google.com with SMTP id my13so3208659bkb.21 for ; Tue, 10 Sep 2013 15:56:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=l6fOqE5QOFZfdu/QBQsXWGls1ayhgew7MV4HIB2Xi2o=; b=w7ndnXbisKjJaZC/I7Tfjs7JS5eCxwcdAh+UrxUVJ4zB97aFw1y2I/h64Gm8RyadBO 5rxU/6n985vtpoj2vHXONm5aMVmTr+yPJXyKIZXpSm8VPmMdHeE9FqF/TMQAUMQwS0T2 1W6Cus+xasxJB04tFyvbwS96x8Rf4rgQQoK8J9ENFKGYsEqKzr8T5V9Gxg3LOlfMhqCy 9hX+5L6mGZy4aVXGbLoMjZE6kzBO6oKx/i8ccJJ5hm3GMsR4Y4svfSUSI6Gruy/bUdAq yBjdt9cJR2xRpCq8UH8VvZPhV4DroLQTUECo2FwULYJta2Py0HjamqvJ63KSJyA7/Xw1 tuUA== MIME-Version: 1.0 X-Received: by 10.204.167.140 with SMTP id q12mr20452512bky.2.1378853795575; Tue, 10 Sep 2013 15:56:35 -0700 (PDT) Received: by 10.205.13.74 with HTTP; Tue, 10 Sep 2013 15:56:35 -0700 (PDT) Date: Wed, 11 Sep 2013 06:56:35 +0800 Message-ID: Subject: [PATCH] drm/exynos: fix return value check in lowlevel_buffer_allocate() From: Wei Yongjun To: inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, kgene.kim@samsung.com X-Mailman-Approved-At: Wed, 11 Sep 2013 00:40:32 -0700 Cc: yongjun_wei@trendmicro.com.cn, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Wei Yongjun In case of error, the function drm_prime_pages_to_sg() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun --- drivers/gpu/drm/exynos/exynos_drm_buf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 3445a0f..e3ee833 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c @@ -90,9 +90,9 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, } buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages); - if (!buf->sgt) { + if (IS_ERR(buf->sgt)) { DRM_ERROR("failed to get sg table.\n"); - ret = -ENOMEM; + ret = PTR_ERR(buf->sgt); goto err_free_attrs; }