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: 16592 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BFF83238EC for ; Thu, 2 May 2013 12:05:19 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id a11sf858677qen.8 for ; Thu, 02 May 2013 05:05:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=vKMZg9R3pC27DeqT70iLNyJMEe7e6g+oXPDeBdN4Yrs=; b=AuuxqcPCkieh+QBoElCrz4WYKAGakgYHeKuhHd3jwjNVtQ2XNndxncqJ6MVxABuVlv 5W5APY7WDBeuB/0DKM9vwH6Ot0ohAs9hNIiZzRQfnlMpNX5HX6zzB191joQfWknqvzzR ui9+Hm2kFI457MDhaO1FkqWh5ydvvsqfZK9s0wZSC0pA3Hj7jY6Ba7G3+VIHJLlrT1sm p29oawZ4wQl4i/x0hY2+sch1TGjqb2r/VEz6kc+D4c/3tPsc7tfi/WirBUEbVqhAdZwE rzlXV6SQTpkbLjdzJZlFAAV7rty2dJt7cRwY2W7iNpMhVwQsV6Vn0HZmJxH/KEfV+gXS 3F/w== X-Received: by 10.58.132.163 with SMTP id ov3mr5709710veb.17.1367496312352; Thu, 02 May 2013 05:05:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.108.134 with SMTP id hk6ls1316936qeb.72.gmail; Thu, 02 May 2013 05:05:12 -0700 (PDT) X-Received: by 10.220.172.2 with SMTP id j2mr2048367vcz.17.1367496312177; Thu, 02 May 2013 05:05:12 -0700 (PDT) Received: from mail-vb0-x231.google.com (mail-vb0-x231.google.com [2607:f8b0:400c:c02::231]) by mx.google.com with ESMTPS id ij9si2773815vdb.43.2013.05.02.05.05.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 05:05:12 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::231 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::231; Received: by mail-vb0-f49.google.com with SMTP id q12so365668vbe.8 for ; Thu, 02 May 2013 05:05:12 -0700 (PDT) X-Received: by 10.52.228.71 with SMTP id sg7mr1659365vdc.51.1367496312051; Thu, 02 May 2013 05:05:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp198523veb; Thu, 2 May 2013 05:05:11 -0700 (PDT) X-Received: by 10.66.118.39 with SMTP id kj7mr9514655pab.90.1367496310885; Thu, 02 May 2013 05:05:10 -0700 (PDT) Received: from mail-pb0-x22c.google.com (mail-pb0-x22c.google.com [2607:f8b0:400e:c01::22c]) by mx.google.com with ESMTPS id mr7si4414217pbb.167.2013.05.02.05.05.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 05:05:10 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c01::22c is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=2607:f8b0:400e:c01::22c; Received: by mail-pb0-f44.google.com with SMTP id wz17so314675pbc.17 for ; Thu, 02 May 2013 05:05:10 -0700 (PDT) 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: ALoCoQkrLfSfKI9u3EiRcnr1Kma029jEBJd19Yr/ubhFr5FwB8Z7PAGJsJYVvAnTyyswQ+Jw41cC X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::231 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)