From patchwork Sun Jul 15 14:09:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 1198971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 5430DE0004 for ; Sun, 15 Jul 2012 14:12:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SqPWq-0001S8-DO; Sun, 15 Jul 2012 14:10:32 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SqPWa-0001Ru-Un for linux-arm-kernel@lists.infradead.org; Sun, 15 Jul 2012 14:10:18 +0000 Received: by pbbrq13 with SMTP id rq13so9639074pbb.36 for ; Sun, 15 Jul 2012 07:10:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=F58SpoM1XCXHQ4GaniAIsfVB0rQ7OxgKQ8UnAP6iZME=; b=kINLuG2T3Vy6GF/JuEJt32YK/dTv80RBzVnWQw21NxGgu04Ffk26c6vaBFb5SE/THi w4Q4YDt6VGu1AlnFZFIpUPiDKUXRlk5kTpJquCPUM0dwEryRAx8EZDFjxBbW0fRzORIA 8+j1fOLU2e+efnKyX+l3W3dZArCjj/4yrAgzrygabS3bTP/XwTg8pR4w90YFuAGx0epW p+qtd0dQerOEO9gh3TkR5vf0verPw1avIMm2KIXBF8OcOWQbwl+ENUUZh+mALFdHPXjC cvKnQlTfS70iQsV5CV8SV6osG8/dWc/sLSFuRgAcXV4lh/CHoH6UZ1O1ANEusArpNA3T VLjA== Received: by 10.66.79.40 with SMTP id g8mr16250066pax.27.1342361412449; Sun, 15 Jul 2012 07:10:12 -0700 (PDT) Received: from localhost.localdomain ([114.216.235.4]) by mx.google.com with ESMTPS id qd2sm6137091pbb.29.2012.07.15.07.10.06 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jul 2012 07:10:11 -0700 (PDT) From: Shawn Guo To: Mike Turquette Subject: [PATCH] clk: fix clk_get on of_clk_get_by_name return check Date: Sun, 15 Jul 2012 22:09:44 +0800 Message-Id: <1342361384-21299-1-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.5.4 X-Gm-Message-State: ALoCoQl92W134/Q9eEH8jzvRcB81ju+IZ96zqck0+LyOZPiggkpGeifvOBTye++XMnGU9JZtmyAU X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Shawn Guo , Mike Turquette , linux-arm-kernel@lists.infradead.org, Rob Herring X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The commit 766e6a4 (clk: add DT clock binding support) plugs device tree clk lookup of_clk_get_by_name into clk_get, and fall on non-DT lookup clk_get_sys if DT lookup fails. The return check on of_clk_get_by_name takes (clk != NULL) as a successful DT lookup. But it's not the case. For any system that does not define clk lookup in device tree, ERR_PTR(-ENOENT) will be returned, and consequently, all the client drivers calling clk_get in their probe functions will fail to probe with error code -ENOENT returned. Fix the issue by checking of_clk_get_by_name return with !IS_ERR(clk). Signed-off-by: Shawn Guo Acked-by: Rob Herring Tested-by: Marek Vasut Tested-by: Lauri Hintsala --- drivers/clk/clkdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 20649b3..69085e0 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -157,7 +157,7 @@ struct clk *clk_get(struct device *dev, const char *con_id) if (dev) { clk = of_clk_get_by_name(dev->of_node, con_id); - if (clk && __clk_get(clk)) + if (!IS_ERR(clk) && __clk_get(clk)) return clk; }