From patchwork Thu May 2 05:03:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 2510001 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D1D5BDF215 for ; Thu, 2 May 2013 05:16:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751041Ab3EBFQX (ORCPT ); Thu, 2 May 2013 01:16:23 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:46142 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822Ab3EBFQX (ORCPT ); Thu, 2 May 2013 01:16:23 -0400 Received: by mail-pa0-f52.google.com with SMTP id bg2so149046pad.25 for ; Wed, 01 May 2013 22:16:22 -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=HSb6ZIFyQ/KTJqEqV0mXXsw6Drs5AHHzMC5Y//uhyvY=; b=GeYxT2/roG/mOAid/sNAtAGQAEX+L7cl21PGdQ6blXatvUu1E+huiPXV751j64S3TF k9sFbuLpxAiQfWv6K4/V8mOZ2og4fwWoTr2/InCkctGOZEe9J7QIEvRAV3njFuDI+anZ ylGm41wDKq9yqvDzP+IqAW9Rc9q/CtZ5EL8UJXE2pkj3PLNnElpNu3N0uvHDWZT7ObYJ /mmCuzpZ7JOGMgTt3WHoqANXorwvNElSbXnuAzcJoNTXIUKVoqR9coonNOHzclbY/V+Y FSxz3GOqWYJJtH0SEyQ4EfKDJ+JnpUA9OA0aFMpsRTrdxg2p2NVdFwl9jtkntPGv+bIk cCSA== X-Received: by 10.66.174.143 with SMTP id bs15mr8218553pac.17.1367471782531; Wed, 01 May 2013 22:16:22 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id fx2sm6710367pac.4.2013.05.01.22.16.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 May 2013 22:16:21 -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 v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Date: Thu, 2 May 2013 10:33:28 +0530 Message-Id: <1367471009-7103-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlaplXt/L08AtzDLHfK0iHz/zgJ15jC/zOs3H290DKg3crcP1oEYpSMM4vZtNVZaMSCu78D 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 --- Changes since v1: Initialised clocks to invalid value. --- drivers/media/platform/s5p-tv/hdmi_drv.c | 18 ++++++++++++------ 1 file changed, 12 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..ed1a695 100644 --- a/drivers/media/platform/s5p-tv/hdmi_drv.c +++ b/drivers/media/platform/s5p-tv/hdmi_drv.c @@ -765,15 +765,15 @@ 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)); } @@ -793,8 +793,14 @@ static int hdmi_resources_init(struct hdmi_device *hdev) dev_dbg(dev, "HDMI resource init\n"); memset(res, 0, sizeof(*res)); - /* get clocks, power */ + 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); + + /* get clocks, power */ res->hdmi = clk_get(dev, "hdmi"); if (IS_ERR(res->hdmi)) { dev_err(dev, "failed to get clock 'hdmi'\n");