From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 16 Apr 2016 02:04:51 +0200 (CEST) Received: from smtp.codeaurora.org ([198.145.29.96]:59047 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S27026634AbcDPAEsQ2sNU (ORCPT ); Sat, 16 Apr 2016 02:04:48 +0200 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 1DA22615F1; Sat, 16 Apr 2016 00:04:45 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 01C6B615D8; Sat, 16 Apr 2016 00:04:44 +0000 (UTC) Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sboyd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 68495605B6; Sat, 16 Apr 2016 00:04:44 +0000 (UTC) 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@lists.linux-m68k.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) X-Virus-Scanned: ClamAV using ClamSMTP Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 53020 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: sboyd@codeaurora.org Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips 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