From patchwork Thu Aug 14 01:00:03 2014 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: 4731071 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 6B99B9F38C for ; Sun, 17 Aug 2014 11:38:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 937F52012D for ; Sun, 17 Aug 2014 11:38:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E3EE820122 for ; Sun, 17 Aug 2014 11:38:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 94B696E3A6; Sun, 17 Aug 2014 04:38:39 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from m12-15.163.com (m12-15.163.com [220.181.12.15]) by gabe.freedesktop.org (Postfix) with ESMTP id 93E4A6E131 for ; Wed, 13 Aug 2014 18:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=EHelRyp20BeOi13qZ5 Fy7XtXfBtHuess7uIkffAtji8=; b=dIZWvZdLIJ4W9cU57W9lCGPz46AZZPFHcX 6re6xC24sBMEDnmldB0sn7bTWWHHLXg2DoXD2JGwacwqM+FazTMD+z5+SzPENwZK rF0qOvwREVi50zjjax8IXAijzGwUWSlcqE3/GG1FnFdTsLXK7eSL6xw8j0yynw1l 59f037pbM= Received: from localhost.localdomain.localdomain (unknown [49.77.231.131]) by smtp11 (Coremail) with SMTP id D8CowEDJFpQTCuxTtAR_AA--.1231S2; Thu, 14 Aug 2014 09:00:04 +0800 (CST) X-Coremail-DSSMTP: 49.77.231.131 From: weiyj_lk@163.com To: David Airlie , Grant Likely , Rob Herring , Benjamin Gaignard , Rob Clark Subject: [PATCH] drm: sti: Fix return value check in sti_drm_platform_probe() Date: Thu, 14 Aug 2014 09:00:03 +0800 Message-Id: <1407978003-15595-1-git-send-email-weiyj_lk@163.com> X-Mailer: git-send-email 1.9.3 X-CM-TRANSID: D8CowEDJFpQTCuxTtAR_AA--.1231S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr4DZF4DJr4UXFWDCryxAFb_yoWfKFb_C3 yrZr9xXF4kCFyDtF12kF43AasayFZ09F4fXw1rta4ftrW3Jw1Yqa4UuF1DuF1jkr40yrZ8 twn7ur4fur9xGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU5ltCDUUUUU== X-Originating-IP: [49.77.231.131] X-CM-SenderInfo: pzhl5yxbonqiywtou0bp/xtbByhfn1lO+XJPY5wAAsx X-Mailman-Approved-At: Sun, 17 Aug 2014 04:38:33 -0700 Cc: Wei Yongjun , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: Wei Yongjun In case of error, the function platform_device_register_resndata() 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/sti/sti_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_drm_drv.c b/drivers/gpu/drm/sti/sti_drm_drv.c index a7cc249..c8a8412 100644 --- a/drivers/gpu/drm/sti/sti_drm_drv.c +++ b/drivers/gpu/drm/sti/sti_drm_drv.c @@ -201,8 +201,8 @@ static int sti_drm_platform_probe(struct platform_device *pdev) master = platform_device_register_resndata(dev, DRIVER_NAME "__master", -1, NULL, 0, NULL, 0); - if (!master) - return -EINVAL; + if (IS_ERR(master)) + return PTR_ERR(master); platform_set_drvdata(pdev, master); return 0;