From patchwork Sun May 21 01:19:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9739097 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 F3F7460326 for ; Sun, 21 May 2017 14:43:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7B72286B7 for ; Sun, 21 May 2017 14:43:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC699286D7; Sun, 21 May 2017 14:43:47 +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_ADSP_CUSTOM_MED, 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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AB46D286B7 for ; Sun, 21 May 2017 14:43:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 869526E19F; Sun, 21 May 2017 14:43:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0940D895C1 for ; Sun, 21 May 2017 01:19:48 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id u187so13644794pgb.1 for ; Sat, 20 May 2017 18:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y2M7q8OO9PsHolUAyKNQyouHBJtr6xzcQuGCGVfR1os=; b=sOuUqZFpB+wZFNsF5cGifwEAS4iwxeiZ33u4Q1Spg0FJPgJYp5+YWvWFzQ6yJ3CvGO 1M3Spj53qSYK+fz1t/4N4jo4yEV5HAWKPp5rUyRu8Lt1iejxy3QAC/vX5yesski4u+Sd GmgvPAOn6nXEjYxRkEA5GkhcuM9BE/NWOrCEyn7CX7EZR3+irbmD16vangKiwcX/jOuL w0bG1kzmaYAh6y5tuChDdaRBe1KtTQHkT4nUWyVjSi99lg6FtmwCDLQYHb/XVa3Rx7JL yIyxtK+eL39RbZLlWJOH45aGAMO1G4/uyyo4vvAklmso1CGeIFbx/nfoO14Xy5gSo7L+ wNlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y2M7q8OO9PsHolUAyKNQyouHBJtr6xzcQuGCGVfR1os=; b=LNBXjSxiQtuvwAPDQfAGrzhWFM5FIx7SONuadG+00X7rQsH8CJW54iWz1qe2Y8SvbO DCKGoBEGRG5hVx7Rled/uZwPzJ8l7sExbKZOIO6iXuxuJIhHEKAQbZLQVfLH/KkXk475 86/CP7rM+yg9lKSdAeuezxC3dSS5rI+evOxiYCbcD04Y/NxWfHt1vK+MR5TalaJPsn/7 ey0fsFMLNiEmwPiZblrXJNSkWu5MwBp+1fYTpPo2MKzxEcy5+yC72igTp3J9Utuast1K f1O4UR604O3Q0jhSn5IuGCwgwh65ZvkwdBdChKQ+Yew8KOWAw7JLxhM7yE5RJzyEtqqO SmoQ== X-Gm-Message-State: AODbwcBUFMsyNj+8U6IHdkvy8tRBzYOOKQuKZOnn7Vb5/Xzw57huuzf8 OytLj5bD3+UNzw== X-Received: by 10.99.115.90 with SMTP id d26mr17919630pgn.179.1495329587592; Sat, 20 May 2017 18:19:47 -0700 (PDT) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id h89sm23955005pfh.45.2017.05.20.18.19.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 May 2017 18:19:46 -0700 (PDT) From: Wei Yongjun To: David Airlie , Dave Jiang , Miklos Szeredi , Daniel Vetter , Chris Wilson , Sean Paul , Laura Abbott , Matthew Auld Subject: [PATCH -next] drm/vgem: Fix return value check in vgem_init() Date: Sun, 21 May 2017 01:19:39 +0000 Message-Id: <20170521011939.8111-1-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 21 May 2017 14:43:01 +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 platform_device_register_simple() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 315f0242aa2b ("drm/vgem: Convert to a struct drm_device subclass") Signed-off-by: Wei Yongjun --- drivers/gpu/drm/vgem/vgem_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 54ec94c..18f401b 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -438,8 +438,8 @@ static int __init vgem_init(void) vgem_device->platform = platform_device_register_simple("vgem", -1, NULL, 0); - if (!vgem_device->platform) { - ret = -ENODEV; + if (IS_ERR(vgem_device->platform)) { + ret = PTR_ERR(vgem_device->platform); goto out_fini; }