From patchwork Thu Jul 4 13:35:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2823711 Return-Path: X-Original-To: patchwork-linux-arm@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 0B8859F3C3 for ; Thu, 4 Jul 2013 13:35:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D14BC20179 for ; Thu, 4 Jul 2013 13:35:37 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88A6520177 for ; Thu, 4 Jul 2013 13:35:36 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uujh2-00042h-Sa; Thu, 04 Jul 2013 13:35:29 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uujh0-00007R-DS; Thu, 04 Jul 2013 13:35:26 +0000 Received: from mail-bk0-x22e.google.com ([2a00:1450:4008:c01::22e]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uujgx-00005C-95 for linux-arm-kernel@lists.infradead.org; Thu, 04 Jul 2013 13:35:24 +0000 Received: by mail-bk0-f46.google.com with SMTP id na10so648830bkb.5 for ; Thu, 04 Jul 2013 06:35:00 -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=J8qmuaxIFNOkkZDEFx0Kq1jS51m11zlsLHJcqzpsZk8=; b=p9VUvkJP6+FhxvnroGicoYITXJLXG3QOxzvWjKwqkpUZLqbLckZixX8y7T/PzhXzXD cVg+6sc3x2F4tIXpU8S8D8v0y761Hsk+p/cwPvGkskThk1ZHbeNru8OV9uj69L1aTaOe jLLuN8mNpj1U71FaF2AbmAnT0N+8j6oAyt9OPGB8yjXAZa/pNGv2JMGTBVQNT7KCcW7K DSPmfXLZMx0oGB7uC7UDyiWhR+m/BloHPN80piwrIS23Tg44ksCcRCMkn5vmRa08Ecq3 qvzIXnIK+yNwbimvYFU+t0DJoiBKPhDqpCeTO/6WiS5f3cbOGnFcQn8F8xq/p2piB1qC 89nA== MIME-Version: 1.0 X-Received: by 10.204.189.80 with SMTP id dd16mr1061850bkb.126.1372944900573; Thu, 04 Jul 2013 06:35:00 -0700 (PDT) Received: by 10.205.122.72 with HTTP; Thu, 4 Jul 2013 06:35:00 -0700 (PDT) Date: Thu, 4 Jul 2013 21:35:00 +0800 Message-ID: Subject: [PATCH] drm/exynos: exynos_drm_ipp: fix return value check From: Wei Yongjun To: inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, kgene.kim@samsung.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130704_093523_466247_28941101 X-CRM114-Status: GOOD ( 10.57 ) X-Spam-Score: -2.0 (--) Cc: yongjun_wei@trendmicro.com.cn, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 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 ipp_find_obj() 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 Reviewed-by: Tomasz Figa --- drivers/gpu/drm/exynos/exynos_drm_ipp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index b1ef8e7..0eb8538 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -342,10 +342,10 @@ int exynos_drm_ipp_get_property(struct drm_device *drm_dev, void *data, */ ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, prop_list->ipp_id); - if (!ippdrv) { + if (IS_ERR(ippdrv)) { DRM_ERROR("not found ipp%d driver.\n", prop_list->ipp_id); - return -EINVAL; + return PTR_ERR(ippdrv); } prop_list = ippdrv->prop_list; @@ -970,9 +970,9 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, void *data, /* find command node */ c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, qbuf->prop_id); - if (!c_node) { + if (IS_ERR(c_node)) { DRM_ERROR("failed to get command node.\n"); - return -EFAULT; + return PTR_ERR(c_node); } /* buffer control */ @@ -1106,9 +1106,9 @@ int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data, c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, cmd_ctrl->prop_id); - if (!c_node) { + if (IS_ERR(c_node)) { DRM_ERROR("invalid command node list.\n"); - return -EINVAL; + return PTR_ERR(c_node); } if (!exynos_drm_ipp_check_valid(ippdrv->dev, cmd_ctrl->ctrl,