All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"marex@denx.de" <marex@denx.de>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH for-5.8 v2] usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails
Date: Sat, 4 Jul 2020 05:58:55 +0000	[thread overview]
Message-ID: <9405e834-cae9-ee69-aa6b-77a8484e78ec@synopsys.com> (raw)
In-Reply-To: <20200703225043.387769-1-martin.blumenstingl@googlemail.com>



On 7/4/2020 2:50 AM, Martin Blumenstingl wrote:
> Call dwc2_debugfs_exit() and dwc2_hcd_remove() (if the HCD was enabled
> earlier) when usb_add_gadget_udc() has failed. This ensures that the
> debugfs entries created by dwc2_debugfs_init() as well as the HCD are
> cleaned up in the error path.
> 
> Fixes: 207324a321a866 ("usb: dwc2: Postponed gadget registration to the udc class driver")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Acked-by: Minas Harutyunyan <hminas@synopsys.com>

> ---
> Changes since v1 at [0]
> - also cleanup the HCD as suggested by Minas (thank you!)
> - updated the subject accordingly
> 
> 
> [0] https://urldefense.com/v3/__https://patchwork.kernel.org/patch/11631381/__;!!A4F2R9G_pg!K0ZJIzYVYtrwy2VgxTI28Z_qA995uqmg1dFrMNx3XMQ653ROMKPkt_zQdJe1OOk$
> 
> 
>   drivers/usb/dwc2/platform.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index c347d93eae64..9febae441069 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -582,12 +582,16 @@ static int dwc2_driver_probe(struct platform_device *dev)
>   		retval = usb_add_gadget_udc(hsotg->dev, &hsotg->gadget);
>   		if (retval) {
>   			dwc2_hsotg_remove(hsotg);
> -			goto error_init;
> +			goto error_debugfs;
>   		}
>   	}
>   #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
>   	return 0;
>   
> +error_debugfs:
> +	dwc2_debugfs_exit(hsotg);
> +	if (hsotg->hcd_enabled)
> +		dwc2_hcd_remove(hsotg);
>   error_init:
>   	if (hsotg->params.activate_stm_id_vb_detection)
>   		regulator_disable(hsotg->usb33d);
> 

  reply	other threads:[~2020-07-04  5:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 22:50 [PATCH for-5.8 v2] usb: dwc2: Add missing cleanups when usb_add_gadget_udc() fails Martin Blumenstingl
2020-07-04  5:58 ` Minas Harutyunyan [this message]
2020-07-26 10:04 ` Minas Harutyunyan
2020-07-27 17:35   ` Martin Blumenstingl
2020-07-04  6:04 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9405e834-cae9-ee69-aa6b-77a8484e78ec@synopsys.com \
    --to=minas.harutyunyan@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.