From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8EFFC433DF for ; Wed, 20 May 2020 16:45:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6DFB2070A for ; Wed, 20 May 2020 16:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726823AbgETQp6 (ORCPT ); Wed, 20 May 2020 12:45:58 -0400 Received: from netrider.rowland.org ([192.131.102.5]:40405 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726545AbgETQp5 (ORCPT ); Wed, 20 May 2020 12:45:57 -0400 Received: (qmail 13248 invoked by uid 1000); 20 May 2020 12:45:56 -0400 Date: Wed, 20 May 2020 12:45:56 -0400 From: "stern@rowland.harvard.edu" To: "Sverdlin, Alexander \(Nokia - DE/Ulm\)" Cc: "dinghao.liu@zju.edu.cn" , "kjlu@umn.edu" , "mpm@selenic.com" , "gregkh@linuxfoundation.org" , "herbert@gondor.apana.org.au" , "ben.dooks@codethink.co.uk" , "linux-kernel@vger.kernel.org" , "arnd@arndb.de" , "allison@lohutok.net" , "yuehaibing@huawei.com" , "rfontana@redhat.com" , "linux-crypto@vger.kernel.org" , "tglx@linutronix.de" Subject: Re: [PATCH] hwrng: ks-sa - fix runtime pm imbalance on error Message-ID: <20200520164556.GC11084@rowland.harvard.edu> References: <20200520132957.18776-1-dinghao.liu@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 20, 2020 at 03:42:17PM +0000, Sverdlin, Alexander (Nokia - DE/Ulm) wrote: > Hello Dinghao, > > On Wed, 2020-05-20 at 21:29 +0800, Dinghao Liu wrote: > > pm_runtime_get_sync() increments the runtime PM usage counter even > > the call returns an error code. Thus a pairing decrement is needed > > on the error handling path to keep the counter balanced. > > I believe, this is the wrong place for such kind of fix. > pm_runtime_get_sync() has obviously a broken semantics with regards to > your observation but no other driver does what you propose. Look again. For example, see what usb_autoresume_device() in drivers/usb/core/driver.c does. You really shouldn't make generalizations such as "no other driver does ..." unless you have read the code for every driver in the kernel. Alan Stern