From patchwork Fri May 17 04:31:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 2581051 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 34EA740E12 for ; Fri, 17 May 2013 04:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752633Ab3EQEog (ORCPT ); Fri, 17 May 2013 00:44:36 -0400 Received: from mail-da0-f41.google.com ([209.85.210.41]:64396 "EHLO mail-da0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751660Ab3EQEog (ORCPT ); Fri, 17 May 2013 00:44:36 -0400 Received: by mail-da0-f41.google.com with SMTP id y19so2117607dan.14 for ; Thu, 16 May 2013 21:44:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=A86mbrMXFfylUsdL+8gnQPrdC1Zc6aVwpocf7KMsPM4=; b=BOlIvRtJevk8wrUbtfbNthbubY41X0OyLt0CmC0s5cxmp/uzGJyXyeUKfS4o+Acjz7 yQgSMeemewV+HTV0hgeu71hoiPOH2o6W3JLJQKtW3uKYQexpojoSbCN1AV6TJ2r/5E3r 059eZFsZgD+h77ZPS2Z1Qw2VaDlyr8va/dHExOBqaYma9Uh4DXsWhR/SE8preV/pzJlL mJe2Ih8AQU1rmNBm0asG/TQAUZ++k7foxEMYHj73BJOwFqU0xtiDXAWSwCSXQXQwf0TD 7yB+6sGwY0JKn6nY9IXzVIFJdzIwM1eYCrd1tS6foHe+m2VvGVAh+uvXQUApcjLRogOT T8yg== X-Received: by 10.66.240.70 with SMTP id vy6mr47623403pac.70.1368765875614; Thu, 16 May 2013 21:44:35 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id aa8sm10477520pad.14.2013.05.16.21.44.32 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 21:44:35 -0700 (PDT) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: t.stanislaws@samsung.com, sylvester.nawrocki@gmail.com, s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH v4 2/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in mixer_drv.c Date: Fri, 17 May 2013 10:01:02 +0530 Message-Id: <1368765062-6194-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1368765062-6194-1-git-send-email-sachin.kamat@linaro.org> References: <1368765062-6194-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQl3TkmK9o2hps2sSx0RbT40AH5un856JL0C2ZkRt+bNE0kbEWBzhYYgPf3p4nO9TkuBTQsB Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org NULL check on clocks obtained using common clock APIs should not be done. Use IS_ERR only. Signed-off-by: Sachin Kamat --- drivers/media/platform/s5p-tv/mixer_drv.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c index 5733033..7aeefdb 100644 --- a/drivers/media/platform/s5p-tv/mixer_drv.c +++ b/drivers/media/platform/s5p-tv/mixer_drv.c @@ -211,6 +211,15 @@ fail: return ret; } +static void mxr_resource_clear_clocks(struct mxr_resources *res) +{ + res->mixer = ERR_PTR(-EINVAL); + res->vp = ERR_PTR(-EINVAL); + res->sclk_mixer = ERR_PTR(-EINVAL); + res->sclk_hdmi = ERR_PTR(-EINVAL); + res->sclk_dac = ERR_PTR(-EINVAL); +} + static void mxr_release_plat_resources(struct mxr_device *mdev) { free_irq(mdev->res.irq, mdev); @@ -222,15 +231,15 @@ static void mxr_release_clocks(struct mxr_device *mdev) { struct mxr_resources *res = &mdev->res; - if (!IS_ERR_OR_NULL(res->sclk_dac)) + if (!IS_ERR(res->sclk_dac)) clk_put(res->sclk_dac); - if (!IS_ERR_OR_NULL(res->sclk_hdmi)) + if (!IS_ERR(res->sclk_hdmi)) clk_put(res->sclk_hdmi); - if (!IS_ERR_OR_NULL(res->sclk_mixer)) + if (!IS_ERR(res->sclk_mixer)) clk_put(res->sclk_mixer); - if (!IS_ERR_OR_NULL(res->vp)) + if (!IS_ERR(res->vp)) clk_put(res->vp); - if (!IS_ERR_OR_NULL(res->mixer)) + if (!IS_ERR(res->mixer)) clk_put(res->mixer); } @@ -239,7 +248,9 @@ static int mxr_acquire_clocks(struct mxr_device *mdev) struct mxr_resources *res = &mdev->res; struct device *dev = mdev->dev; - res->mixer = clk_get(dev, "mixer"); + mxr_resource_clear_clocks(res); + + res->mixer = clk_get(dev, "mixer"); if (IS_ERR(res->mixer)) { mxr_err(mdev, "failed to get clock 'mixer'\n"); goto fail; @@ -299,6 +310,7 @@ static void mxr_release_resources(struct mxr_device *mdev) mxr_release_clocks(mdev); mxr_release_plat_resources(mdev); memset(&mdev->res, 0, sizeof(mdev->res)); + mxr_resource_clear_clocks(&mdev->res); } static void mxr_release_layers(struct mxr_device *mdev)