From patchwork Wed Jul 13 12:43:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: weiyj_lk@163.com X-Patchwork-Id: 9229177 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6ED496075D for ; Thu, 14 Jul 2016 08:09:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6097626464 for ; Thu, 14 Jul 2016 08:09:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 550312810E; Thu, 14 Jul 2016 08:09:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17BD026464 for ; Thu, 14 Jul 2016 08:09:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C1686E89B; Thu, 14 Jul 2016 08:09:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 946 seconds by postgrey-1.35 at gabe; Wed, 13 Jul 2016 13:00:08 UTC Received: from m12-15.163.com (m12-15.163.com [220.181.12.15]) by gabe.freedesktop.org (Postfix) with ESMTP id 10E8B6E2D3 for ; Wed, 13 Jul 2016 13:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=PcJ6r ylq8WjysARB08UWa4GvwqZpo+Ar+97DI7830nQ=; b=VThiL25ZYf/vM80OZBWGF lm2FPB/iYE+mRVQrSOkUN0TTENAy0eN/VA7auzADMTH4EnmZNt+9dST05ECKhao+ fKNpSMRemR4BNs5wHja6xqw+9jt6cZ+hHvpaxcenG0GQa13FQN1dV+SFmFIE1BCo NkJAI1iXqQZteVi0qvfqyA= Received: from localhost.localdomain.localdomain (unknown [180.102.101.186]) by smtp11 (Coremail) with SMTP id D8CowABHc9CMN4ZXx0M+DA--.41743S2; Wed, 13 Jul 2016 20:43:57 +0800 (CST) From: weiyj_lk@163.com To: Xinliang Liu , Xinwei Kong , Chen Feng , David Airlie Subject: [PATCH -next] drm/hisilicon: Fix return value check in ade_dts_parse() Date: Wed, 13 Jul 2016 12:43:56 +0000 Message-Id: <1468413836-2405-1-git-send-email-weiyj_lk@163.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-CM-TRANSID: D8CowABHc9CMN4ZXx0M+DA--.41743S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJF17JrWUKryfuFyxZw1rXrb_yoW8XFykpr s8XFW2yrWYv3y7Aa43t34UXFyava47tay8Ww18uwn5ZF1fZr4UXwn0v3W0qF48Zr97G342 qF4kG3y3ua1UurDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jXxhLUUUUU= X-Originating-IP: [180.102.101.186] X-CM-SenderInfo: pzhl5yxbonqiywtou0bp/1tbiJRil1lUMAvlboQACsU X-Mailman-Approved-At: Thu, 14 Jul 2016 08:08:24 +0000 Cc: Wei Yongjun , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun In case of error, the function devm_clk_get() 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/hisilicon/kirin/kirin_drm_ade.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 805f432..c3707d4 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -967,21 +967,21 @@ static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx) } ctx->ade_core_clk = devm_clk_get(dev, "clk_ade_core"); - if (!ctx->ade_core_clk) { + if (IS_ERR(ctx->ade_core_clk)) { DRM_ERROR("failed to parse clk ADE_CORE\n"); - return -ENODEV; + return PTR_ERR(ctx->ade_core_clk); } ctx->media_noc_clk = devm_clk_get(dev, "clk_codec_jpeg"); - if (!ctx->media_noc_clk) { + if (IS_ERR(ctx->media_noc_clk)) { DRM_ERROR("failed to parse clk CODEC_JPEG\n"); - return -ENODEV; + return PTR_ERR(ctx->media_noc_clk); } ctx->ade_pix_clk = devm_clk_get(dev, "clk_ade_pix"); - if (!ctx->ade_pix_clk) { + if (IS_ERR(ctx->ade_pix_clk)) { DRM_ERROR("failed to parse clk ADE_PIX\n"); - return -ENODEV; + return PTR_ERR(ctx->ade_pix_clk); } return 0;