From patchwork Mon Oct 21 03:34:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 3078251 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 6B7179F2B8 for ; Mon, 21 Oct 2013 14:37:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 215C820306 for ; Mon, 21 Oct 2013 14:37:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3F02B2039E for ; Mon, 21 Oct 2013 14:37:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1138DE7272 for ; Mon, 21 Oct 2013 07:37:43 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f48.google.com (mail-bk0-f48.google.com [209.85.214.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 321E1E5C41 for ; Sun, 20 Oct 2013 20:34:09 -0700 (PDT) Received: by mail-bk0-f48.google.com with SMTP id my13so531111bkb.35 for ; Sun, 20 Oct 2013 20:34:07 -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=/79MyuEw9X3Cnv//fOEPaBdFAIfmDNfZcN9AKInP4a4=; b=EoDPfqrSTeubukbOYacQuNCXXLxwEoMRSbX6seUpMxvh2M9/9X2QhkMsyu+VG3ZGgO UEDTKQMNYjUUCaeiUGzKd/27ZioMXe0wUyqvdbqQon9+rlIrCXK81JA3J4KqyHVg4A8r NZ7LkytnrGpPE3rpmLGknoaya6utd8RdbNPeaDCUC0qzbw5EU7qABIGcSou4rNiS2L1e xK/7peLKK0C6ZesTJQy0Y1JII/D+fA00Px7yWRGy9pYRuPt4A0VywXxVMQRQd0RFk9QR M4Pcd0gNVpkugHLbSaKQdKIq7JMKta0xOxImU+a8yaoJC5azaBZpkEsdS48rs42M/eIq ZyCw== MIME-Version: 1.0 X-Received: by 10.204.68.142 with SMTP id v14mr5894318bki.18.1382326447658; Sun, 20 Oct 2013 20:34:07 -0700 (PDT) Received: by 10.205.19.10 with HTTP; Sun, 20 Oct 2013 20:34:07 -0700 (PDT) Date: Mon, 21 Oct 2013 11:34:07 +0800 Message-ID: Subject: [PATCH -next] drm/tegra: fix return value check From: Wei Yongjun To: thierry.reding@gmail.com, tbergstrom@nvidia.com, airlied@linux.ie, swarren@wwwdotorg.org, grant.likely@linaro.org, rob.herring@calxeda.com X-Mailman-Approved-At: Mon, 21 Oct 2013 07:34:39 -0700 Cc: linux-tegra@vger.kernel.org, yongjun_wei@trendmicro.com.cn, 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.5 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 clk_get_parent() and devm_ioremap_resource() 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/tegra/dsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c index 1cfbace..7bc2eeb 100644 --- a/drivers/gpu/drm/tegra/dsi.c +++ b/drivers/gpu/drm/tegra/dsi.c @@ -914,7 +914,7 @@ static int tegra_dsi_setup_clocks(struct tegra_dsi *dsi) int err; parent = clk_get_parent(dsi->clk); - if (!parent) + if (IS_ERR(parent)) return -EINVAL; err = clk_set_parent(parent, dsi->clk_parent); @@ -969,8 +969,8 @@ static int tegra_dsi_probe(struct platform_device *pdev) regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); dsi->regs = devm_ioremap_resource(&pdev->dev, regs); - if (!dsi->regs) - return -EADDRNOTAVAIL; + if (IS_ERR(dsi->regs)) + return PTR_ERR(dsi->regs); INIT_LIST_HEAD(&dsi->client.list); dsi->client.ops = &dsi_client_ops;