Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752575AbcDPAEt (ORCPT ); Fri, 15 Apr 2016 20:04:49 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:34812 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbcDPAEq (ORCPT ); Fri, 15 Apr 2016 20:04:46 -0400 Date: Fri, 15 Apr 2016 17:04:43 -0700 From: Stephen Boyd To: Masahiro Yamada Cc: linux-mips@linux-mips.org, Rich Felker , linux-sh@vger.kernel.org, Michael Turquette , Greg Ungerer , linux-clk@vger.kernel.org, Russell King , Yoshinori Sato , Magnus Damm , Geert Uytterhoeven , Wan ZongShun , Steven Miao , adi-buildroot-devel@lists.sourceforge.net, Haojian Zhuang , linux-m68k@vger.kernel.org, Simon Horman , linux-arm-kernel , John Crispin , Eric Miao , Ryan Mallon , Linux Kernel Mailing List , Ralf Baechle , linux-renesas-soc@vger.kernel.org, Hartley Sweeten Subject: Re: [PATCH v2] clk: let clk_disable() return immediately if clk is NULL or error Message-ID: <20160416000443.GA26353@codeaurora.org> References: <1459821083-28116-1-git-send-email-yamada.masahiro@socionext.com> <20160408003328.GA14441@codeaurora.org> <20160414003341.GH14441@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 611 Lines: 21 On 04/14, Masahiro Yamada wrote: > > OK, now I notice another problem in my code; > if foo_clk_init() fails for reason [2], > clk_disable() WARN's due to zero enable_count. > > if (WARN_ON(core->enable_count == 0)) > return; > > > > Perhaps, I got screwed up by splitting clock init stuff > into a helper function. Yep! Can't we just split the enable/disable out into another function separate from the clk_get/put part? That would make things more symmetric and avoid this problem. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project