From patchwork Fri May 17 04:31:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 17007 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4407B2391B for ; Fri, 17 May 2013 04:45:15 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id cz11sf5079733veb.6 for ; Thu, 16 May 2013 21:44:34 -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 :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=zudwBcSVcZ7e6E6RRM1EguA/OtRXIbxIDykMAChlGfQ=; b=pfzpGy5WI3mLgqWFuARnlFqSBq97J38YCL7i9EPYS2UkCwGCoAsHrXgAo685nKZbvV HHT1R9zxa4w4kI16XnQ2xX4zvrO931ZQtXgZd3iInFLdDpB6PNqTI9RML5Bnczgv/cGS sFN0hwT3e2M7Ri9ZlvkNkgIpj1LAcZwfQKHkOeK6sRh7ZpslgFUCd1ar/w/9QLUA2Wmh lV/QMjAnmjsJjB8+kNppe1hkv7tJ4RFud+WlZuUN8Y5v3qOlTNWqvC5hPx8dle5qgcZI LSmOl3RgopP/amaE3tJ4e9U2mOUImkHMJ5YO8v67vVHNR1DMrvWvv6j9Vf0hURkybBoj tdFw== X-Received: by 10.224.165.130 with SMTP id i2mr27333593qay.2.1368765874308; Thu, 16 May 2013 21:44:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.62.138 with SMTP id y10ls1364191qer.74.gmail; Thu, 16 May 2013 21:44:34 -0700 (PDT) X-Received: by 10.58.34.166 with SMTP id a6mr29450273vej.17.1368765874162; Thu, 16 May 2013 21:44:34 -0700 (PDT) Received: from mail-vb0-x22f.google.com (mail-vb0-x22f.google.com [2607:f8b0:400c:c02::22f]) by mx.google.com with ESMTPS id gs2si5155033vdc.50.2013.05.16.21.44.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 21:44:34 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22f 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::22f; Received: by mail-vb0-f47.google.com with SMTP id x14so1928284vbb.6 for ; Thu, 16 May 2013 21:44:34 -0700 (PDT) X-Received: by 10.220.46.197 with SMTP id k5mr29527756vcf.40.1368765873921; Thu, 16 May 2013 21:44:33 -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.220.126.138 with SMTP id c10csp91264vcs; Thu, 16 May 2013 21:44:33 -0700 (PDT) X-Received: by 10.68.189.231 with SMTP id gl7mr30439700pbc.123.1368765872639; Thu, 16 May 2013 21:44:32 -0700 (PDT) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by mx.google.com with ESMTPS id yh2si6861308pab.293.2013.05.16.21.44.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 21:44:32 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.179 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.192.179; Received: by mail-pd0-f179.google.com with SMTP id q10so2971939pdj.10 for ; Thu, 16 May 2013 21:44:32 -0700 (PDT) X-Received: by 10.66.121.234 with SMTP id ln10mr45281472pab.129.1368765871942; Thu, 16 May 2013 21:44:31 -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.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 21:44:31 -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 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Date: Fri, 17 May 2013 10:01:01 +0530 Message-Id: <1368765062-6194-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmM8F1HkGnG7r4DIWT4m/8in8FqjMUY/eSmDKL5bTDiFGWX5uefUDBpaUehCGUobux/ULf0 X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22f 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 --- Based on for-next branch of git://linuxtv.org/snawrocki/samsung.git Changes since v3: Renamed the function and changed the prototype of {hdmi,mxr}_reset_clocks as suggested by Sylwester. --- drivers/media/platform/s5p-tv/hdmi_drv.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c index 4e86626..cd525f1 100644 --- a/drivers/media/platform/s5p-tv/hdmi_drv.c +++ b/drivers/media/platform/s5p-tv/hdmi_drv.c @@ -755,6 +755,15 @@ static const struct dev_pm_ops hdmi_pm_ops = { .runtime_resume = hdmi_runtime_resume, }; +static void hdmi_resource_clear_clocks(struct hdmi_resources *res) +{ + res->hdmi = ERR_PTR(-EINVAL); + res->sclk_hdmi = ERR_PTR(-EINVAL); + res->sclk_pixel = ERR_PTR(-EINVAL); + res->sclk_hdmiphy = ERR_PTR(-EINVAL); + res->hdmiphy = ERR_PTR(-EINVAL); +} + static void hdmi_resources_cleanup(struct hdmi_device *hdev) { struct hdmi_resources *res = &hdev->res; @@ -765,17 +774,18 @@ static void hdmi_resources_cleanup(struct hdmi_device *hdev) regulator_bulk_free(res->regul_count, res->regul_bulk); /* kfree is NULL-safe */ kfree(res->regul_bulk); - if (!IS_ERR_OR_NULL(res->hdmiphy)) + if (!IS_ERR(res->hdmiphy)) clk_put(res->hdmiphy); - if (!IS_ERR_OR_NULL(res->sclk_hdmiphy)) + if (!IS_ERR(res->sclk_hdmiphy)) clk_put(res->sclk_hdmiphy); - if (!IS_ERR_OR_NULL(res->sclk_pixel)) + if (!IS_ERR(res->sclk_pixel)) clk_put(res->sclk_pixel); - 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->hdmi)) + if (!IS_ERR(res->hdmi)) clk_put(res->hdmi); memset(res, 0, sizeof(*res)); + hdmi_resource_clear_clocks(res); } static int hdmi_resources_init(struct hdmi_device *hdev) @@ -793,8 +803,9 @@ static int hdmi_resources_init(struct hdmi_device *hdev) dev_dbg(dev, "HDMI resource init\n"); memset(res, 0, sizeof(*res)); - /* get clocks, power */ + hdmi_resource_clear_clocks(res); + /* get clocks, power */ res->hdmi = clk_get(dev, "hdmi"); if (IS_ERR(res->hdmi)) { dev_err(dev, "failed to get clock 'hdmi'\n");