From patchwork Wed Sep 17 15:56:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 4925131 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 227109F2EC for ; Wed, 17 Sep 2014 15:55:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7749A20166 for ; Wed, 17 Sep 2014 15:56:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 876942015D for ; Wed, 17 Sep 2014 15:56:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755740AbaIQP40 (ORCPT ); Wed, 17 Sep 2014 11:56:26 -0400 Received: from www.linutronix.de ([62.245.132.108]:49688 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755698AbaIQP4Z convert rfc822-to-8bit (ORCPT ); Wed, 17 Sep 2014 11:56:25 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1XUHah-0007Km-Mk; Wed, 17 Sep 2014 17:56:23 +0200 Date: Wed, 17 Sep 2014 17:56:23 +0200 From: Sebastian Andrzej Siewior To: Nishanth Menon Cc: Tero Kristo , Mike Turquette , linux-omap@vger.kernel.org Subject: [PATCH v2] CLK: TI: consider the fact that of_clk_get() might return an error Message-ID: <20140917155623.GA28043@linutronix.de> References: <1410451272-31068-1-git-send-email-bigeasy@linutronix.de> <54198411.1080706@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <54198411.1080706@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I "forgot" to update the dtb and the kernel crashed: |Unable to handle kernel NULL pointer dereference at virtual address 0000002e |PC is at __clk_get_flags+0x4/0xc |LR is at ti_dt_clockdomains_setup+0x70/0xe8 because I did not have the clock nodes. of_clk_get() returns an error pointer which is not checked here. Signed-off-by: Sebastian Andrzej Siewior Acked-by: Nishanth Menon --- v1…v2: add "%s __func__" to the added pr_err * Nishanth Menon | 2014-09-17 07:52:33 [-0500]: > >Could you add %s: __func__ as well - it kinda helps understand this >is part of clockdomain setup and not some driver cribbing that it did >not get some clock. As you wish. drivers/clk/ti/clockdomain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c index f1e0038d76ac..446481166ce9 100644 --- a/drivers/clk/ti/clockdomain.c +++ b/drivers/clk/ti/clockdomain.c @@ -36,6 +36,12 @@ static void __init of_ti_clockdomain_setup(struct device_node *node) for (i = 0; i < num_clks; i++) { clk = of_clk_get(node, i); + if (IS_ERR(clk)) { + pr_err("%s: Failed get %s' clock nr %d (%ld)\n", + __func__, node->full_name, i, + PTR_ERR(clk)); + continue; + } if (__clk_get_flags(clk) & CLK_IS_BASIC) { pr_warn("can't setup clkdm for basic clk %s\n", __clk_get_name(clk));