From patchwork Thu May 2 11:52:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 2511291 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 6F1133FD85 for ; Thu, 2 May 2013 12:05:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756939Ab3EBMFM (ORCPT ); Thu, 2 May 2013 08:05:12 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:35027 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753159Ab3EBMFL (ORCPT ); Thu, 2 May 2013 08:05:11 -0400 Received: by mail-pa0-f44.google.com with SMTP id jh10so323846pab.17 for ; Thu, 02 May 2013 05:05:10 -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=vKMZg9R3pC27DeqT70iLNyJMEe7e6g+oXPDeBdN4Yrs=; b=hTxrkR1fhlgUh7FUI/77BTLo6h3fyilK927cSl9B5Br7OvRVudJaQjTMjxqaRw9ybU kVplfs+ZuW5V7h5mTzmtVIUzFlVTAXO3CzzPrLUxg7q4v78SEuvth5mvEGoGDQ9qsagN z8iBSOdmqOyCHHoy1KpzOPW4I8rULSin14RvEJftoaLw2CpZ4ZQwQB4JLOA4bIZ0wIhS xH4EaurkjbkxSa1Tbn3NXuKQPK6bHRLf1KIrgxOewqTNZOl6NVcSE4E5wt8ZQrQlRX9X oWuT4pDiKxO79J8XqVN8pDLRLyDZQubp7waUwIAVospBTc7qK/vii2XLVo77F+aeG3x2 m1WQ== X-Received: by 10.66.119.34 with SMTP id kr2mr9433104pab.149.1367496310356; Thu, 02 May 2013 05:05:10 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id dr6sm8043722pac.11.2013.05.02.05.05.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 05:05:09 -0700 (PDT) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: t.stanislaws@samsung.com, s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH v3 2/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in mixer_drv.c Date: Thu, 2 May 2013 17:22:15 +0530 Message-Id: <1367495535-12888-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1367495535-12888-1-git-send-email-sachin.kamat@linaro.org> References: <1367495535-12888-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQk+aohg54RI6fqjDPK1VSyDctcp90/W42XQZ8MUftscAby7n+3w16D/zw1Rg8acKwpOjAu5 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 | 26 ++++++++++++++++++++------ 1 file changed, 20 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..bdee3bb 100644 --- a/drivers/media/platform/s5p-tv/mixer_drv.c +++ b/drivers/media/platform/s5p-tv/mixer_drv.c @@ -211,6 +211,17 @@ fail: return ret; } +static void mxr_reset_clocks(struct mxr_device *mdev) +{ + struct mxr_resources *res = &mdev->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 +233,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 +250,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_reset_clocks(mdev); + + res->mixer = clk_get(dev, "mixer"); if (IS_ERR(res->mixer)) { mxr_err(mdev, "failed to get clock 'mixer'\n"); goto fail; @@ -299,6 +312,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_reset_clocks(mdev); } static void mxr_release_layers(struct mxr_device *mdev)