From patchwork Thu May 2 11:52:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 16591 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 309E1238EC for ; Thu, 2 May 2013 12:05:17 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id m1sf849248ves.10 for ; Thu, 02 May 2013 05:05:09 -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=24V/obMTlblplnEOfnjpJ99np985bNoQnWqHH8nDt4o=; b=hm8/HC/nAHfGaB1yaAoRDlyQuzmp3WAuOj7Yg2tzQQyS8MfrXRdmOa//C4tqRiKks4 6HBAxHayK7gb6b2goARyPUAa8DwNC1ykIv3HpIDaEjFDegJdfc4N87kS9g7WikTq+1wT RLfAwQzhjioD353CNDqQU12jJy0bjCaQq/leqqjPkiyoTZboBoiCcJkKPpFfGTJzjlNk fNp4Cjzpjg2ga0PBfcWgCmIN4az/L1ow1xtiUmaDcTha6LgdJEIPlxe/pAumElB6IZ3X gXpmQcVEmm0JVmUDypuqYmz3eB4oK/30uGD9Wb88PQ6cuS4c7CattfeimlnvCyFVE6da /3EQ== X-Received: by 10.58.240.116 with SMTP id vz20mr5971112vec.6.1367496309719; Thu, 02 May 2013 05:05:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.200 with SMTP id w8ls11612qen.1.gmail; Thu, 02 May 2013 05:05:09 -0700 (PDT) X-Received: by 10.52.71.4 with SMTP id q4mr1760697vdu.8.1367496309462; Thu, 02 May 2013 05:05:09 -0700 (PDT) Received: from mail-ve0-x22e.google.com (mail-ve0-x22e.google.com [2607:f8b0:400c:c01::22e]) by mx.google.com with ESMTPS id sc6si2765725vdc.73.2013.05.02.05.05.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 05:05:09 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22e 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:c01::22e; Received: by mail-ve0-f174.google.com with SMTP id pb11so388391veb.19 for ; Thu, 02 May 2013 05:05:09 -0700 (PDT) X-Received: by 10.220.242.73 with SMTP id lh9mr2008090vcb.49.1367496309331; Thu, 02 May 2013 05:05:09 -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 nf2csp198521veb; Thu, 2 May 2013 05:05:08 -0700 (PDT) X-Received: by 10.66.228.233 with SMTP id sl9mr9458245pac.38.1367496308072; Thu, 02 May 2013 05:05:08 -0700 (PDT) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by mx.google.com with ESMTPS id yh2si4919256pab.235.2013.05.02.05.05.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 05:05:08 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.170 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.192.170; Received: by mail-pd0-f170.google.com with SMTP id 10so322267pdi.15 for ; Thu, 02 May 2013 05:05:07 -0700 (PDT) X-Received: by 10.68.200.162 with SMTP id jt2mr8492430pbc.138.1367496307509; Thu, 02 May 2013 05:05:07 -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.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 May 2013 05:05:06 -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 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Date: Thu, 2 May 2013 17:22:14 +0530 Message-Id: <1367495535-12888-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnD6WulZEZEwMWBwFR8wYtM1Su6D5P/8QZ+gwWVtFuWWPjzp9t5C73u70GodpPsOD1egb64 X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22e 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 --- Changes since v2: Moved clock reset code to a function. --- drivers/media/platform/s5p-tv/hdmi_drv.c | 25 +++++++++++++++++++------ 1 file changed, 19 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..2f2d430 100644 --- a/drivers/media/platform/s5p-tv/hdmi_drv.c +++ b/drivers/media/platform/s5p-tv/hdmi_drv.c @@ -755,6 +755,17 @@ static const struct dev_pm_ops hdmi_pm_ops = { .runtime_resume = hdmi_runtime_resume, }; +static void hdmi_reset_clocks(struct hdmi_device *hdev) +{ + struct hdmi_resources *res = &hdev->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 +776,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_reset_clocks(hdev); } static int hdmi_resources_init(struct hdmi_device *hdev) @@ -793,8 +805,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_reset_clocks(hdev); + /* get clocks, power */ res->hdmi = clk_get(dev, "hdmi"); if (IS_ERR(res->hdmi)) { dev_err(dev, "failed to get clock 'hdmi'\n");