Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4591895rwd; Sun, 4 Jun 2023 08:25:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5li0Q0XWAcjky2UdXHAj/VL39oNfGiTmMCBZXE3sKronYrRBRAjLCrlnBZdhAJKQcVmIsu X-Received: by 2002:a17:90a:17ad:b0:258:edec:52d2 with SMTP id q42-20020a17090a17ad00b00258edec52d2mr3419046pja.28.1685892341383; Sun, 04 Jun 2023 08:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685892341; cv=none; d=google.com; s=arc-20160816; b=BpHlhnQxJCK1i7ppVNwWS3PuVF72azR3Rv3dTans+40np8oAe6decSApQFhyRYgbYJ 8gbUFcTSkOjpOEXT1hUhvQDyY5FTrrMUlBynVNxuAryosiuMyY6eRW4GXKdJBqRb7xXD YJOGls/hWUSZbI6d+eDtZULd/b0FmHeDLued1v7SHVmqL20YKTC0jnCLLys+cf4d8BYa Ini1T6O/zF811H1QsfuKJsYAbB8BzYA9/eTLgGXllZFQQk2oVC8VqaizI48tGEJTTx8o 4AHeRU6L8zB/MNqWDPgMweyOIjYOrQwz7GIMbspl3v3iIPsYVPtA05pxxkmHEkjKWo0w mc0A== 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:dkim-signature; bh=NfjbgkAX/VWQ3hWeynVgd6EdQsxLuZ5+rb8DZm9QVqs=; b=H0oHARqr5myG1Cqcf5MnMQiNbrfvgTTIO4G0ERxbmQUJCLSKbr6CXbu/NI+L6Ridm+ SHnSl+ZmIpJOwCY1Xn0Euyad/zf7w3Igai6qO0+lOfo5rd+hXklVJ0Yqz8vcOs9OQ4vm 3xTjgMex8iOWZ4CNJ/1XSP3Cun7a8+16yspZjPAqtyAKCybqGgOX3+xhRXh7OUMA44Pe nwkbD3NTq/hg2zM6kL/IgjFTiC1Eo3Bf4ldtqa2HDhooqfw1OH7sgjdGP66IpAGF6nsb JqfBhdqnKEajZqgQcZjkQPAXDy2mRsw66fmWeAFnMb8A2adiXGebvbF1VSimqtXCVXQM BugQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=hULECYwv; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y15-20020a17090a600f00b00247101dd0c1si4394145pji.15.2023.06.04.08.25.26; Sun, 04 Jun 2023 08:25:41 -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=@wanadoo.fr header.s=t20230301 header.b=hULECYwv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230070AbjFDPEp (ORCPT + 99 others); Sun, 4 Jun 2023 11:04:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229806AbjFDPEo (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 646F9CA 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 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_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- 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]); -- 2.34.1