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: 2868001 Return-Path: X-Original-To: patchwork-linux-arm@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 522A09F495 for ; Tue, 10 Sep 2013 22:57:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 531F0203DA for ; Tue, 10 Sep 2013 22:57:18 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 217AB20279 for ; Tue, 10 Sep 2013 22:57:17 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJWrp-0001Jr-Gl; Tue, 10 Sep 2013 22:57:05 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJWrn-0004aG-AQ; Tue, 10 Sep 2013 22:57:03 +0000 Received: from mail-bk0-x22d.google.com ([2a00:1450:4008:c01::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJWrj-0004Zq-1M for linux-arm-kernel@lists.infradead.org; Tue, 10 Sep 2013 22:57:01 +0000 Received: by mail-bk0-f45.google.com with SMTP id mx11so3207251bkb.4 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130910_185659_210668_52CD1242 X-CRM114-Status: GOOD ( 12.09 ) X-Spam-Score: -2.0 (--) 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: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 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; }