[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9de38c5f-6fdb-5fc0-3fd3-bec42b8807a2@synopsys.com>
Date: Sun, 26 Jul 2020 10:04:40 +0000
From: Minas Harutyunyan <Minas.Harutyunyan@...opsys.com>
To: Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"marex@...x.de" <marex@...x.de>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH for-5.8 v2] usb: dwc2: Add missing cleanups when
usb_add_gadget_udc() fails
Hi Martin,
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@...glemail.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;
>
Kernel test robot found issue:
>> warning: unused label 'error_debugfs' [-Wunused-label]
error_debugfs:
^~~~~~~~~~~~~~
1 warning generated.
So, 'error_debugfs:' label should be under #if/#endif:
#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
error_debugfs:
#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
Or you have other suggestion?
Could you please fix this issue and submit new version of patch.
Thanks,
Minas
> +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);
>
Powered by blists - more mailing lists