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: 2581041 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 1B7D540AEC for ; Fri, 17 May 2013 04:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752256Ab3EQEod (ORCPT ); Fri, 17 May 2013 00:44:33 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:57111 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752116Ab3EQEoc (ORCPT ); Fri, 17 May 2013 00:44:32 -0400 Received: by mail-pb0-f46.google.com with SMTP id rq13so2932999pbb.5 for ; Thu, 16 May 2013 21:44:32 -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 :x-gm-message-state; bh=zudwBcSVcZ7e6E6RRM1EguA/OtRXIbxIDykMAChlGfQ=; b=kIMTFCskbqih+g2X/5yDvWPAAyo9tHXkbraQjroNvYG6+95wfwSuOckIkX9v6qEk/s 3spIxZpD3saK0grOhle+gJ/AP67r+zdH1uCsSssdryNRgI6376cL7gJtA4DxdJfN/rf9 D2eKv74yqPecFmKXfLFZNTB62bUjFo3h/B7nbeeyE+LhD//aKaKEsQlaNMKD3GHuWOB6 QwG5Du9tvOWoUZYOyov64pBhQc/ZVj086dOJvs1IsLXK4b/gg0s2cQXEUOS5l6xoSvXM AIwJuSmGFdSq0Fl+Py6n5WlvDBY3qZ3nwerD+KMXytpawVl1LFeAOOeTm7Pkx/35yEkv UGmQ== 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: ALoCoQklnWdtrFNuByk6hQh31lcQscy6pUYS164DeX2IKeJRhRK5GbdPXxrDTxIa4pzCtQiC0Nc9 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 --- 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");