From patchwork Thu Sep 6 14:25:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 11214 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E922E23EFE for ; Thu, 6 Sep 2012 14:26:08 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 38007A18380 for ; Thu, 6 Sep 2012 14:25:12 +0000 (UTC) Received: by iafj25 with SMTP id j25so1915553iaf.11 for ; Thu, 06 Sep 2012 07:26:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=pZicqJWEceRMdfpYBio/LnPHpLYHpWmy9//W/DU6VYo=; b=Gc7/vhhAxNawnobRbiqiFEhW9nS4FFcw9/we0pDTRDMCWAjTQ/UvKYX1iQvxReVfUP 7hw2WjhKoAqdI6Wl2i3ktRTMRI32zVbr99WsxL/bf+mVLAS/BpyiXvtQ6QcgxJMlrhC1 b99cqpwj5biSnkK3lzSGyDf7B9bW6xTI3ejOtglTtUyWbOqS20h/9TCB//015EdydJ5D 00jjXFlGtoZXoFYZIIoGyi9E6sfEABWDgqcCuA/HtoO8VQoWuavzuleciQY4SU4YVIU6 EkUpvyd8XBi4JknBBqK67Ms23T06zLbK9FkGpD8uaXNNRpHVha2/aLVHVwdXd+/lyQ+V hcVg== Received: by 10.50.242.3 with SMTP id wm3mr11097960igc.0.1346941567947; Thu, 06 Sep 2012 07:26:07 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp322126igc; Thu, 6 Sep 2012 07:26:07 -0700 (PDT) Received: by 10.66.83.166 with SMTP id r6mr3711931pay.25.1346941567147; Thu, 06 Sep 2012 07:26:07 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id mr7si4011092pbb.221.2012.09.06.07.26.06 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Sep 2012 07:26:07 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of chander.kashyap@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of chander.kashyap@linaro.org) smtp.mail=chander.kashyap@linaro.org Received: by pbcmd12 with SMTP id md12so2831339pbc.37 for ; Thu, 06 Sep 2012 07:26:06 -0700 (PDT) Received: by 10.68.134.228 with SMTP id pn4mr4721947pbb.147.1346941566522; Thu, 06 Sep 2012 07:26:06 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id th6sm1433672pbc.0.2012.09.06.07.26.03 (version=SSLv3 cipher=OTHER); Thu, 06 Sep 2012 07:26:05 -0700 (PDT) From: Chander Kashyap To: linux-samsung-soc@vger.kernel.org Cc: kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org, patches@linaro.org Subject: [PATCH 2/2] ARM: SAMSUNG: Add check for NULL in clock interface Date: Thu, 6 Sep 2012 19:55:34 +0530 Message-Id: <1346941534-4501-1-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnStN+tX+bpvdtxrP8v+LnHy+oDi7k9I+LUH8+y5vTjtCLIpjSXqrVWzR7lLfywSYkAJort The clock instance parameter in Samsung clock interface is not being checked for NULL pointers. Add checks for NULL pointers. Signed-off-by: Chander Kashyap Acked-by: Thomas Abraham --- arch/arm/plat-samsung/clock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index 65c5eca..7938fbc 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c @@ -119,7 +119,7 @@ void clk_disable(struct clk *clk) unsigned long clk_get_rate(struct clk *clk) { - if (IS_ERR(clk)) + if (IS_ERR_OR_NULL(clk)) return 0; if (clk->rate != 0) @@ -136,7 +136,7 @@ unsigned long clk_get_rate(struct clk *clk) long clk_round_rate(struct clk *clk, unsigned long rate) { - if (!IS_ERR(clk) && clk->ops && clk->ops->round_rate) + if (!IS_ERR_OR_NULL(clk) && clk->ops && clk->ops->round_rate) return (clk->ops->round_rate)(clk, rate); return rate; @@ -146,7 +146,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate) { int ret; - if (IS_ERR(clk)) + if (IS_ERR_OR_NULL(clk)) return -EINVAL; /* We do not default just do a clk->rate = rate as @@ -175,7 +175,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent) { int ret = 0; - if (IS_ERR(clk)) + if (IS_ERR_OR_NULL(clk) || IS_ERR_OR_NULL(parent)) return -EINVAL; spin_lock(&clocks_lock);