From patchwork Thu Sep 18 14:33:27 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: 4931071 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 795469F32F for ; Thu, 18 Sep 2014 14:32:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1057F20179 for ; Thu, 18 Sep 2014 14:33:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 452B420127 for ; Thu, 18 Sep 2014 14:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755902AbaIROd3 (ORCPT ); Thu, 18 Sep 2014 10:33:29 -0400 Received: from www.linutronix.de ([62.245.132.108]:55224 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755694AbaIROd3 convert rfc822-to-8bit (ORCPT ); Thu, 18 Sep 2014 10:33:29 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1XUclz-0001Am-KM; Thu, 18 Sep 2014 16:33:27 +0200 Date: Thu, 18 Sep 2014 16:33:27 +0200 From: Sebastian Andrzej Siewior To: Tero Kristo , Mike Turquette Cc: linux-omap@vger.kernel.org, Nishanth Menon , linux-arm-kernel@lists.infradead.org Subject: [PATCH v3] CLK: TI: consider the fact that of_clk_get() might return an error Message-ID: <20140918143327.GA4418@linutronix.de> References: <1410451272-31068-1-git-send-email-bigeasy@linutronix.de> <54198411.1080706@ti.com> <20140917155623.GA28043@linutronix.de> <20140917163559.GA25790@kahuna> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140917163559.GA25790@kahuna> 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.5 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. Acked-by: Nishanth Menon Signed-off-by: Sebastian Andrzej Siewior --- v2…v3: - added acked by - fixed "CHECK: Alignment should match open parenthesis" v1…v2: add "%s __func__" to the added pr_err drivers/clk/ti/clockdomain.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c index f1e0038d76ac..b4c5faccaece 100644 --- a/drivers/clk/ti/clockdomain.c +++ b/drivers/clk/ti/clockdomain.c @@ -36,6 +36,11 @@ 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));