From patchwork Wed Feb 11 10:13:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 5811701 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E494C9F37F for ; Wed, 11 Feb 2015 10:14:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B6B12022D for ; Wed, 11 Feb 2015 10:14:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 340D620222 for ; Wed, 11 Feb 2015 10:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751065AbbBKKOU (ORCPT ); Wed, 11 Feb 2015 05:14:20 -0500 Received: from bhuna.collabora.co.uk ([93.93.135.160]:45306 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752159AbbBKKNr (ORCPT ); Wed, 11 Feb 2015 05:13:47 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: javier) with ESMTPSA id 7EDB86004E4 From: Javier Martinez Canillas To: Mike Turquette Cc: Stephen Boyd , Tomeu Vizoso , =?UTF-8?q?Emilio=20L=C3=B3pez?= , linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Martinez Canillas Subject: [PATCH 1/2] clk: Don't dereference parent clock if is NULL Date: Wed, 11 Feb 2015 11:13:30 +0100 Message-Id: <1423649612-31746-2-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1423649612-31746-1-git-send-email-javier.martinez@collabora.co.uk> References: <1423649612-31746-1-git-send-email-javier.martinez@collabora.co.uk> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 The clock passed as an argument to clk_mux_determine_rate_flags() can not have a parent clock if is either a root clock or an orphan. In those cases parent is NULL so parent->hw shouldn't be dereferenced. Fixes: 035a61c314eb3 ("clk: Make clk API return per-user struct clk instances") Signed-off-by: Javier Martinez Canillas --- drivers/clk/clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 7f53166af5e6..7bd8893c94d6 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -799,7 +799,7 @@ clk_mux_determine_rate_flags(struct clk_hw *hw, unsigned long rate, /* if NO_REPARENT flag set, pass through to current parent */ if (core->flags & CLK_SET_RATE_NO_REPARENT) { parent = core->parent; - if (core->flags & CLK_SET_RATE_PARENT) + if (core->flags & CLK_SET_RATE_PARENT && parent) best = __clk_determine_rate(parent->hw, rate, min_rate, max_rate); else if (parent)