From patchwork Sat Jun 10 13:32:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marion & Christophe JAILLET X-Patchwork-Id: 691613 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 4CE86C7EE45 for ; Sat, 10 Jun 2023 13:33:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232128AbjFJNdC (ORCPT ); Sat, 10 Jun 2023 09:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbjFJNdB (ORCPT ); Sat, 10 Jun 2023 09:33:01 -0400 Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24C872D7F for ; Sat, 10 Jun 2023 06:32:59 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 7yi5qGFtQVKwS7yi5qth7a; Sat, 10 Jun 2023 15:32:56 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1686403976; bh=kw2eOSJ4V5gSFaEZFeVcNGutktWcvfZoGnpsREiIJQQ=; h=From:To:Cc:Subject:Date; b=UtCoAA5syEW/TxvW4W3YpIYtZSU51UIR9jSTzm0tptj+Llh8jKD4DCGH2QIA/fsut 1zufdLSmvyXqCzcKqAPUMBblgm0zfyf/C2QGvVj9rQGax99LWOMO8tLpSGZEsv+x2Q +BILiaTpujcAaEUs+x/SfrZngrnu2oTmR6MApU+YNNPXA1vuRecdft8E5GNVsXvkx1 tol9LhHVe+ETUjfgYK0xGEPM/0MPOZRifUkRoLRns0UtbUCQT9n8l7SnNoN4uljYZb 0XH7n06C+3ARMwBK3GMAgjj0iIq4RIhOEih4M7KbTX1+HsyC1Vh9V076htHamhKxT6 HaiiVWE4x5riw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 10 Jun 2023 15:32:56 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Thinh Nguyen , Greg Kroah-Hartman , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Felipe Balbi , Yue Wang , Hanjie Lin Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: [PATCH] usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe() Date: Sat, 10 Jun 2023 15:32:52 +0200 Message-Id: <9d28466de1808ccc756b4cc25fc72c482d133d13.1686403934.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org If dwc3_meson_g12a_otg_init() fails, resources allocated by the previous of_platform_populate() call should be released, as already done in the error handling path. Fixes: 1e355f21d3fb ("usb: dwc3: Add Amlogic A1 DWC3 glue") Signed-off-by: Christophe JAILLET Reviewed-by: Neil Armstrong Reviewed-by: Martin Blumenstingl --- drivers/usb/dwc3/dwc3-meson-g12a.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index 365aec00d302..e99c7489dba0 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -796,7 +796,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) ret = dwc3_meson_g12a_otg_init(pdev, priv); if (ret) - goto err_phys_power; + goto err_plat_depopulate; pm_runtime_set_active(dev); pm_runtime_enable(dev); @@ -804,6 +804,9 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) return 0; +err_plat_depopulate: + of_platform_depopulate(dev); + err_phys_power: for (i = 0 ; i < PHY_COUNT ; ++i) phy_power_off(priv->phys[i]);