Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1058017rwd; Sun, 14 May 2023 11:36:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4UIJrs4UICNwHHeo/eFnlSBf9erzV85RXd+haCtjFjQ+SbipkTKqAMJwuct/WXg8LbLl3/ X-Received: by 2002:a05:6a20:4389:b0:105:6e1d:5605 with SMTP id i9-20020a056a20438900b001056e1d5605mr4005407pzl.62.1684089394479; Sun, 14 May 2023 11:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684089394; cv=none; d=google.com; s=arc-20160816; b=YdhsFXjuDJT1+3r3NSaFEiZc6ZOG80BnXhxlLmM8bnM10FCiicyBixcpi8UcAKJFCw qI8U4XHaJNeBfHsSwSMk2NFm29UfOsgAO7aHj3cbeK1BJ5wOGtHF/yirZzc0IugzU7xv 6d3UrzMQN+ZtB/AQSx5d7Y3d1lezj6xIarctFonYho2YQ7M+BeTX1sY1ados68aSvf1m VIu9Oz+b2scULMu2rdNpS9lZnhguwHFhCNMorw3ihpMAOj/lWQkzLQg9h1RzsJ/TVHSz d9iEJ2i/dk1YhO4JWGQY0I4ZobwkFy7XaydezSi3Cng7hzMxKnhOfVzq7x+/qvgPHc4a mIHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=AZ5kBYQ9a4fD403GDE4Y/1yAmsqdovul0qPZ5EWlY2I=; b=iqxpzRw/6zrsx4/82zCrIeKdBbWdW6l3XjYIKT6laa0ZDmVK2p/aMpsyxmVCozUL3B OBGqx+lPbMLbtpQxT+V+abNaK38GrO3Lljf8gRmOQlo57PuWZ2Wdfh+CLK77orzE/Xvb q7AP/GlAkYzhXzx1ekzL4y7M1D9yAunGgJA6W/iFHSa9vvhSHqWqtUUaQhEez+Utd1au CLshf3nefp7PHKIkuMnVHO3n5fg9fkpcedKPddc4jIwaqOb6LjnNJtKxN5BmAkimiJe1 Wpyui+E18lo06G61sp4NvWjT+3FZCEQTD1mF+UbKENDLPzStJGqyQ2m6dh+iEIYxwVhj Bzeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=sooP8EK2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x69-20020a638648000000b0053422305c20si327227pgd.14.2023.05.14.11.36.19; Sun, 14 May 2023 11:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=sooP8EK2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233797AbjENRoO (ORCPT + 99 others); Sun, 14 May 2023 13:44:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230339AbjENRoN (ORCPT ); Sun, 14 May 2023 13:44:13 -0400 Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C6821BF0; Sun, 14 May 2023 10:44:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1684086250; bh=/0Ryfvnd/iJeMY30BK3ahJlqI43ju5QrawuWSYL332U=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=sooP8EK2X962F2DOCrNVdZ0z1yICIfsJtQL6I6Jin6ejA5OaA1QEl32AvWJ5gZbcm P3C/VBgFXL6/4KGOmFnI+2DFpYS1HZVs6I2acOCbJyD9CDDf7veEt/eh7mYTyNmJAI NNL+NiPokwpeX86ZLcPajT4p0vjtwlMjvoFbN1Lk= Date: Sun, 14 May 2023 19:44:09 +0200 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Christophe JAILLET Cc: Vasily Khoruzhick , Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philipp Zabel , Maxime Ripard , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH] thermal/drivers/sun8i: Fix some error handling paths in sun8i_ths_probe() Message-ID: Mail-Followup-To: =?utf-8?Q?Ond=C5=99ej?= Jirman , Christophe JAILLET , Vasily Khoruzhick , Yangtao Li , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Philipp Zabel , Maxime Ripard , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED References: <26f9e3bb3fcd0c12ea24a44c75b7960da993b68b.1684077651.git.christophe.jaillet@wanadoo.fr> <9ae3f111-e13b-cdd7-317d-316585390952@wanadoo.fr> <61d3dac0-550c-70bd-daf8-352e903de36d@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <61d3dac0-550c-70bd-daf8-352e903de36d@wanadoo.fr> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 14, 2023 at 07:32:54PM +0200, Christophe JAILLET wrote: > > Le 14/05/2023 à 19:10, Ondřej Jirman a écrit : > > On Sun, May 14, 2023 at 07:00:34PM +0200, Christophe JAILLET wrote: > > > > > > Le 14/05/2023 à 17:35, Ondřej Jirman a écrit : > > > > Hello Christophe, > > > > > > > > [...] > > > > > > > > This changes the recommeded order of reset release/clock enable steps, eg. A64 > > > > manual says: > > > > > > > > 3.3.6.4. Gating and reset > > > > > > > > Make sure that the reset signal has been released before the release of > > > > module clock gating; > > > > > > Ok, so moving reset_control_deassert() (and my proposed > > ^^^^^^^^^^^^^^^^^^^^^^ > > > > devm_add_action_or_reset()) just after devm_reset_control_get() should keep > > > the expected order, right? > > > > That would be after reset_control_deassert(). devm_reset_control_get() is just > > resource management, like devm_clk_get(). > > Not sure to get your point. I think you misunderstood what I tried to say. Yes, I just misread what you wrote. What you suggested is fine. kind regards, o. > > I propose to move reset_control_deassert() in a v2. And have > devm_add_action_or_reset() just after it. > > Something like: > > if (tmdev->chip->has_bus_clk_reset) { > tmdev->reset = devm_reset_control_get(dev, NULL); > if (IS_ERR(tmdev->reset)) > return PTR_ERR(tmdev->reset); > > ret = reset_control_deassert(tmdev->reset); > if (ret) > return ret; > > ret = devm_add_action_or_reset(dev, sun8i_ths_reset_control_assert, > tmdev->reset); > if (ret) > return ret; > > tmdev->bus_clk = devm_clk_get_enabled(&pdev->dev, "bus"); > if (IS_ERR(tmdev->bus_clk)) > return PTR_ERR(tmdev->bus_clk); > } > > if (tmdev->chip->has_mod_clk) { > tmdev->mod_clk = devm_clk_get_enabled(&pdev->dev, "mod"); > if (IS_ERR(tmdev->mod_clk)) > return PTR_ERR(tmdev->mod_clk); > } > > ret = clk_set_rate(tmdev->mod_clk, 24000000); > if (ret) > return ret; > > > This would keep the order of operation, still fix the leak in the probe and > still save some LoC. > > Would it make it? > > CJ > > > > > regards, > > o. > > >