Message ID | 9d28466de1808ccc756b4cc25fc72c482d133d13.1686403934.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1553958vqr; Sat, 10 Jun 2023 06:54:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5rHozCOLRzIsPklEfvpTS22b9nfoUfAjhAP0NECz0Y7XzNQe73f5duOZkiJ29V2V21staw X-Received: by 2002:a17:902:b110:b0:1a6:4a64:4d27 with SMTP id q16-20020a170902b11000b001a64a644d27mr1686103plr.40.1686405293715; Sat, 10 Jun 2023 06:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686405293; cv=none; d=google.com; s=arc-20160816; b=CtsEUdCPY53SPIJtsqwYPyeTZguiiHeXYrdnROudNsxMW/IjnkJzv53nNStapSARbV MiyBOs1zTpPLIsT+0F1z5JLyR6vuwledFE6ez05OqS0CtSAjC+LM6jvaVKB4WsMK83r4 GPikFYGGTxv1t7a4R8u2BtV/HHsDvlmk0hZM5H98o4NZcJStLMYuxRtLyvBsB0WW7J1K 2ngKgBqpTdzwT9+xqnguNZcA1gDvmheRwszn9Pecp2N+1dt5sU7pcTzAPSXj8ruHRkem qgzgKzkPC/15r965ctA2xtn8+gr+XW4GWtOu7lEFiHYiz0JktJmY6p551JOwLuHgDu3N hlvg== 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=kw2eOSJ4V5gSFaEZFeVcNGutktWcvfZoGnpsREiIJQQ=; b=eMj0520VU+LUdiTBTfJIw/0/WXqxOjbSFCLS1Nlhf1cFWjKf1PCWfPfHzAcNI9pRV1 9fhuaYG5K/BgvSrJENsSnHETQDdP5vZNe76RZhtDoS0ldEdU/A5cAxbSWptYRDYLRDmK FCS+SNSgArz7ZBpGJBfKIokqOBkLXQM7qXCJKo2pKekLLvFx5hR0fOWlVwyH2+EI5VYd zRU4AGSly57i9lzeXALJVVUzVPg8PVYJWindcSZfJkgTD/AMcyaQotJVfY1i2nRS7Ydb 9k908WgQnv1/hmhKJHEBFRJLtIIXhskyq6skoJ3FcPJAKRg2llZsjnN7FA7n3PP1IilL S4OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=UtCoAA5s; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k18-20020a170902c41200b001a6a3954e0fsi4426891plk.18.2023.06.10.06.54.40; Sat, 10 Jun 2023 06:54:53 -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=UtCoAA5s; 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 S230200AbjFJNdC (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Sat, 10 Jun 2023 09:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231594AbjFJNdB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 10 Jun 2023 09:33:01 -0400 Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CB7A30F4 for <linux-kernel@vger.kernel.org>; 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 <christophe.jaillet@wanadoo.fr> To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Neil Armstrong <neil.armstrong@linaro.org>, Kevin Hilman <khilman@baylibre.com>, Jerome Brunet <jbrunet@baylibre.com>, Martin Blumenstingl <martin.blumenstingl@googlemail.com>, Felipe Balbi <balbi@kernel.org>, Yue Wang <yue.wang@amlogic.com>, Hanjie Lin <hanjie.lin@amlogic.com> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, 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 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=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768324117270195941?= X-GMAIL-MSGID: =?utf-8?q?1768324117270195941?= |
Series |
usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe()
|
|
Commit Message
Christophe JAILLET
June 10, 2023, 1:32 p.m. UTC
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 <christophe.jaillet@wanadoo.fr>
---
drivers/usb/dwc3/dwc3-meson-g12a.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On 10/06/2023 15:32, Christophe JAILLET wrote: > 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 <christophe.jaillet@wanadoo.fr> > --- > 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]); Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
On Sat, Jun 10, 2023 at 3:32 PM Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > > 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 <christophe.jaillet@wanadoo.fr> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> We should move to devm_of_platform_populate() mid term. That said, this fix is good for now because it's simple and can be backported.
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]);