Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp328821rdb; Thu, 16 Nov 2023 23:03:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdjwleR50++JMW0u292pZsWEp0rWe3ZxN/VsaRwbj2DMV3MQwGA9vsM8tZi+PdtK9T6Od3 X-Received: by 2002:a17:903:188:b0:1cc:636f:f37c with SMTP id z8-20020a170903018800b001cc636ff37cmr11730499plg.13.1700204618629; Thu, 16 Nov 2023 23:03:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700204618; cv=none; d=google.com; s=arc-20160816; b=sQW2nhvsJisAsnsesdWAwfhyWlKMQS8wj8CwGCYbQyrgAbpYetSeer9YeCByJoipLv qS6Lik8oR2DO4/7xjg5wt0UZgovSZPGOrt25c+k67OPyxhwPMQOoKv0lCB88giLWmP/E 3t/9ZS2WldVM/Qkoyppc91zprIMKLf2Vbenfw/t63dbAP2lLZvpleKhjYs3bcCpRNTTQ +g3MJC4+NxDR2ImKFFM8ZS+vm4eQCIV13zExID87E5i8Tqv/eQbOJg+XB7otgQUv1mtf F/9VkOgs1wgqOdmVOXS+W6ufu27GrVl39ZxiwQIcO+7Xeag9A5jkKpWm7gnW7xa7/uUi hcOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Z5Yh8voG7g5iVpQS7Iyj1ZAIFJM/JZRCqtwZmDIgE0I=; fh=kcQjMKul7xY+IjIpSZq48ayPICfL75TOdtZhrwm4LQU=; b=oS6xrT4BmjZjAHK3Vsw7PWL49tatH9EhtKTX9z0TCHvLxg3dhWQGwdo1/ndq8XACrm ltQIsNt22hSbbEcBzI8SgrLrtDa9Phb336JwLNkwG2lyf+w+6lc7Ugk1wXx+H4Y0cM2a MvsIL6eDdLktR8PX7elWs62R3YyeUqjT3jwLjIdIbUyK5xVv6nHWEgB/swQvyILnDz3c wZP6z5JRtoHo6pTYFnrZ//Sbwd3eFf0FBznCrLkq4VDLXZCXvgR8RO6FZ+BfKo4TbAC/ /YHplAyN8B1uhvVn0I81TA5/EkuhABtxK5YmtF6UKb4en0VF8Nid+254Ax7wQqVQmGWk An3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y6-20020a17090322c600b001c6154cfda9si1276010plg.356.2023.11.16.23.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 23:03:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0EC11801B934; Thu, 16 Nov 2023 23:03:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbjKQHD2 (ORCPT + 99 others); Fri, 17 Nov 2023 02:03:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjKQHD1 (ORCPT ); Fri, 17 Nov 2023 02:03:27 -0500 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BB2129; Thu, 16 Nov 2023 23:03:21 -0800 (PST) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 3AH73BYb82943171, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 3AH73BYb82943171 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Nov 2023 15:03:12 +0800 Received: from RTEXMBS02.realtek.com.tw (172.21.6.95) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 17 Nov 2023 15:03:12 +0800 Received: from RTEXH36505.realtek.com.tw (172.21.6.25) by RTEXMBS02.realtek.com.tw (172.21.6.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 17 Nov 2023 15:03:11 +0800 Received: from localhost.localdomain (172.21.252.101) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server id 15.1.2375.32 via Frontend Transport; Fri, 17 Nov 2023 15:03:11 +0800 From: Stanley Chang To: Thinh Nguyen CC: Stanley Chang , Christophe JAILLET , Greg Kroah-Hartman , , Subject: [PATCH v3] usb: dwc3: add missing of_node_put and platform_device_put Date: Fri, 17 Nov 2023 15:03:05 +0800 Message-ID: <20231117070311.32502-1-stanley_chang@realtek.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-KSE-ServerInfo: RTEXMBS02.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Thu, 16 Nov 2023 23:03:36 -0800 (PST) of_get_compatible_child performs an of_node_get, so an of_node_put is required. Add platform_device_put to match with of_find_device_by_node. Fixes: 34c200483569 ("usb: dwc3: add Realtek DHC RTD SoC dwc3 glue layer driver") Signed-off-by: Stanley Chang Acked-by: Thinh Nguyen --- v1 to v2 change: 1. Modify the commit message. 2. Add of_node_get in the of_property_read_string() error path. v2 to v3 change: Fix the typo in commit message. --- drivers/usb/dwc3/dwc3-rtk.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-rtk.c b/drivers/usb/dwc3/dwc3-rtk.c index 590028e8fdcb..3cd6b184551c 100644 --- a/drivers/usb/dwc3/dwc3-rtk.c +++ b/drivers/usb/dwc3/dwc3-rtk.c @@ -183,10 +183,13 @@ static enum usb_device_speed __get_dwc3_maximum_speed(struct device_node *np) ret = of_property_read_string(dwc3_np, "maximum-speed", &maximum_speed); if (ret < 0) - return USB_SPEED_UNKNOWN; + goto out; ret = match_string(speed_names, ARRAY_SIZE(speed_names), maximum_speed); +out: + of_node_put(dwc3_np); + return (ret < 0) ? USB_SPEED_UNKNOWN : ret; } @@ -339,6 +342,9 @@ static int dwc3_rtk_probe_dwc3_core(struct dwc3_rtk *rtk) switch_usb2_role(rtk, rtk->cur_role); + platform_device_put(dwc3_pdev); + of_node_put(dwc3_node); + return 0; err_pdev_put: -- 2.34.1