Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp742355rdb; Wed, 1 Nov 2023 00:49:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESl/wu1w5bIebSDR9ruq1O/uJUMZ/D36oYc8JoQSK5wSBT01UXiN8fxMRyTmAyjVTihrRc X-Received: by 2002:a05:6830:3153:b0:6d3:165d:f199 with SMTP id c19-20020a056830315300b006d3165df199mr2227982ots.10.1698824953358; Wed, 01 Nov 2023 00:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698824953; cv=none; d=google.com; s=arc-20160816; b=fvn9+VRq1UhGAYbbXIijJmqDZQcqXWZ2/1rTs2EMfberFf+FHdSomze0WDPyRoYOkf BvIerTQgTz5yQftxZhySuK9K06BbLcQHKLZ1lEIsNMMKmlsLpPQrsAQr5RmDR0lYnzWS TlAyhbkZTU+C5VeHIu1KVhCequUUl2HO9ang0be89FQoPIG3c+ec9Qr6lkAeehZvm0PZ +n9uixUH1E8YmHxi6D8Tfjk7MWlXzrW9LAbWolTEwncEmcpyexhkkN9Ti22M64wxtVER UUfLJV7x1RVt4iIv1tmpkMlx2cikRWK1ql8RJ4JwFNYWXLetEOzFjdyB2qyNoNFeYssX CszQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=CHO9ALMzPTlbEkghyJZxxX8YXlVDHe23Eei/dtpPG50=; fh=271EdO0v1AxDFB0O5fiZlDK4y2rUYD7RvptMflX3SwQ=; b=0x0+2w0fCfjblHU4FG93eYcMn6R3QgOoYexEwvWDM1ueefUYsBUpWon79HbR5DqDU+ nNGXSx1i1/CEwQZZ6zs9tYrYQphA7M3O8aOQD8gTKgzW8UGIKW3UPIKQ0EqrBD4LsAea 49xLSGH/jLsVALSSnpDfQo/0ym/yWXeSPu0TRF8VS/RoDOc6L/0S0so2Td+eBSueIIcs ES187uVG/uGddfPjANuf7PNMFsLRTdfGGqazRhV7y5A3zBVNJsNDfCr1TN9ajzDvPBYh 6HtMR8mKD/4z1mYhAQzqXKY0rPZx3VZBbNZwDGUtFsjBYuF1LM0p8AAezP/ZAX1zqzz0 KmmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=LXdBHclx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cm13-20020a056a020a0d00b005b8817b3cb0si2672859pgb.65.2023.11.01.00.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 00:49:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=LXdBHclx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4FCD18030988; Wed, 1 Nov 2023 00:49:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbjKAHtH (ORCPT + 99 others); Wed, 1 Nov 2023 03:49:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232350AbjKAHs7 (ORCPT ); Wed, 1 Nov 2023 03:48:59 -0400 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8223121 for ; Wed, 1 Nov 2023 00:48:53 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id y5y5qB80Rlciay5y5qrV60; Wed, 01 Nov 2023 08:48:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1698824932; bh=CHO9ALMzPTlbEkghyJZxxX8YXlVDHe23Eei/dtpPG50=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=LXdBHclxjNCD3uIXRewY+ORmSBe35cHR1JjuVFDRDU8kDrSTRifteRQoW4s64jwnT hEAdOYyZJfqc81IOQQKhsFSf/5KRwlKHISzP2jr75ZnqPyHfLc7HIuT47TWZCXfZWt 2bujopMXPT/Mqp/QF2XTTdRwpZdXMOBLIKRvPgCYG0ry3/RS1+P5AHQWP7dR2HLig5 7+WZRU/T+y4jCl/k+TwXlJGKGEllyGJ2i0kEyU4l90WZDtEf38wfgMRFXfc7uEQQW1 WEpakuLrSVci2vxwk0TP7s17m1Ploxi0ciw54aIONfoON4Md3n7RGk9/Rug4xWMT+E WA0TYoGxfamEw== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 01 Nov 2023 08:48:52 +0100 X-ME-IP: 86.243.2.178 Message-ID: Date: Wed, 1 Nov 2023 08:48:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: RE: [PATCH v6 1/2] usb: dwc3: add Realtek DHC RTD SoC dwc3 glue layer driver Content-Language: fr, en-US To: =?UTF-8?B?U3RhbmxleSBDaGFuZ1vmmIzogrLlvrdd?= Cc: "Thinh.Nguyen@synopsys.com" , "conor+dt@kernel.org" , "devicetree@vger.kernel.org" , "gregkh@linuxfoundation.org" , "krzysztof.kozlowski+dt@linaro.org" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "robh+dt@kernel.org" References: <20230826031028.1892-1-stanley_chang@realtek.com> <202310301424.39UEOShlC2187546@rtits1.realtek.com.tw> From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 01 Nov 2023 00:49:12 -0700 (PDT) Le 01/11/2023 à 07:27, Stanley Chang[昌育德] a écrit : > Hi CJ, > > I think these functions are not needed in remove function. > > In dwc3_rtk_probe_dwc3_core, > I have used > dwc3_node = of_get_compatible_child(node, "snps,dwc3"); > and > dwc3_pdev = of_find_device_by_node(dwc3_node); > > So, I call these put functions. > platform_device_put(dwc3_pdev); > of_node_put(dwc3_node); Yes, but you call it only in the error handling path of the function. I wonder if they should also be called in the remove function in order to decrement the ref-counted reference. Same in __get_dwc3_maximum_speed(), the reference taken by: dwc3_np = of_get_compatible_child(np, "snps,dwc3"); is never released. See the comment at [1] to see what I mean. [1]: https://elixir.bootlin.com/linux/v6.6/source/drivers/of/base.c#L681 CJ > > Thanks, > Stanley > >> Hi, >> >> Is something like >> platform_device_put(dwc3_pdev); >> of_node_put(dwc3_node); >> needed in the remove function? >> >> (as done in the error handling path of dwc3_rtk_probe_dwc3_core()) >> >> Or should it be added at the end of dwc3_rtk_probe_dwc3_core() if the >> reference are nor needed anymore when we leave the function? >> >> CJ >> >>> + of_platform_depopulate(rtk->dev); } >>> + >> >> ... >