From patchwork Sun Jun 4 15:04:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 689189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 727D7C77B73 for ; Sun, 4 Jun 2023 15:04:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231766AbjFDPEp (ORCPT ); Sun, 4 Jun 2023 11:04:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231204AbjFDPEo (ORCPT ); Sun, 4 Jun 2023 11:04:44 -0400 Received: from smtp.smtpout.orange.fr (smtp-29.smtpout.orange.fr [80.12.242.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 650F5CD for ; Sun, 4 Jun 2023 08:04:43 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 5pHaqkubz3VqD5pHaqmLaW; Sun, 04 Jun 2023 17:04:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1685891081; bh=NfjbgkAX/VWQ3hWeynVgd6EdQsxLuZ5+rb8DZm9QVqs=; h=From:To:Cc:Subject:Date; b=hULECYwvTeJyaJ2a7O6eNOVCbIezpWGQL6hghC6xVzVT2MYnklEtC0aLHdKHN+5FO 3VFeh//4tZktLv43+8sEoGBgPk+goBtMM3L2cmRfH/ow65WiqS6Hm5zE10g1DhMMhM HC46iYgxTbWhp9Gq0SUgAC6lgOUYPtZY5XyyrJ6iyiT3ukanR9KvY0NgBb679/qFtK t/7hUCAKXCqk4HY7DG/oB/eJGNbVLBM8gNM91J7NX9lXfI73kUMT2tYfh05wAU7JKS yVLWamHgANOWVhShruMjwn4L3PrQGI87lX7gsSLVERMHd1JrR+X1d5JPWVSf8x17bY wBu6qbf39zZoA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 04 Jun 2023 17:04:41 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Thinh Nguyen , Greg Kroah-Hartman , Felipe Balbi , Lee Jones Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH] usb: dwc3: qcom: Release the correct resources in dwc3_qcom_remove() Date: Sun, 4 Jun 2023 17:04:37 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org In the probe, some resources are allocated with dwc3_qcom_of_register_core() or dwc3_qcom_acpi_register_core(). The corresponding resources are already coorectly freed in the error handling path of the probe, but not in the remove function. Fix it. Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI") Signed-off-by: Christophe JAILLET Reviewed-by: Andrew Halaney --- drivers/usb/dwc3/dwc3-qcom.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index aa96c473f839..9c95f1d909ba 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -942,11 +942,15 @@ static int dwc3_qcom_probe(struct platform_device *pdev) static void dwc3_qcom_remove(struct platform_device *pdev) { struct dwc3_qcom *qcom = platform_get_drvdata(pdev); + struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; int i; device_remove_software_node(&qcom->dwc3->dev); - of_platform_depopulate(dev); + if (np) + of_platform_depopulate(&pdev->dev); + else + platform_device_put(pdev); for (i = qcom->num_clocks - 1; i >= 0; i--) { clk_disable_unprepare(qcom->clks[i]);