From patchwork Tue Sep 10 22:56:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2871201 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DB7B2BF43F for ; Wed, 11 Sep 2013 08:01:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73454202EC for ; Wed, 11 Sep 2013 08:01:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2C55F202EA for ; Wed, 11 Sep 2013 08:00:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E497E7387 for ; Wed, 11 Sep 2013 01:00:57 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f41.google.com (mail-bk0-f41.google.com [209.85.214.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 0ECD9E601A for ; Tue, 10 Sep 2013 15:56:13 -0700 (PDT) Received: by mail-bk0-f41.google.com with SMTP id na10so3259348bkb.14 for ; Tue, 10 Sep 2013 15:56:12 -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=mScUdQQph+QXutNBS2q80q5G3gnjeboBFP5kTkce+jo=; b=q5U7COmzikQmlH4Pf36pYJoaiLZFnjTTGzoG0Grc+MkJftKg+TP97OOWz765qbxYMX M9NoUmNuA2RU7kjBIFVsH4eSXDq69voqebooQVeLCmtie9cO1DITGWSuVuVlOFwwuNwT 1Un2+3ypEs0galOh2jWr9Qb2HKYw1f5b+539CIFEvEU+Y+UbbNQ8SVWlc9UOu4K/Xt+k bVZYwtBQVs9LUthWg52B0FWX/xhOEk2kA28ruvNk8/W/vvz5jXpS3v0fZmvdmifi6H9k FdKe3Zu12EbkvjL01vosL4uSNoBA98QpyJ6yWt+LBStQ6AgMVz9zGlsHbJBUzQdDpRy+ fwCA== MIME-Version: 1.0 X-Received: by 10.204.76.203 with SMTP id d11mr21693674bkk.3.1378853772879; Tue, 10 Sep 2013 15:56:12 -0700 (PDT) Received: by 10.205.13.74 with HTTP; Tue, 10 Sep 2013 15:56:12 -0700 (PDT) Date: Wed, 11 Sep 2013 06:56:12 +0800 Message-ID: Subject: [PATCH] drm/msm: fix return value check in ERR_PTR() From: Wei Yongjun To: airlied@linux.ie, robdclark@gmail.com X-Mailman-Approved-At: Wed, 11 Sep 2013 00:40:31 -0700 Cc: yongjun_wei@trendmicro.com.cn, linux-kernel@vger.kernel.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/msm/msm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 6b5a6c8..3462def 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -40,9 +40,9 @@ static struct page **get_pages(struct drm_gem_object *obj) } msm_obj->sgt = drm_prime_pages_to_sg(p, npages); - if (!msm_obj->sgt) { + if (IS_ERR(msm_obj->sgt)) { dev_err(dev->dev, "failed to allocate sgt\n"); - return ERR_PTR(-ENOMEM); + return ERR_CAST(msm_obj->sgt); } msm_obj->pages = p;