[PATCH 5/5] usb: ohci-nxp: clean up probe error labels

Johan Hovold posted 5 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH 5/5] usb: ohci-nxp: clean up probe error labels
Posted by Johan Hovold 1 month, 3 weeks ago
Error labels should be named after what they do rather than after from
where they are jumped to.

Rename the probe error labels for consistency and to improve
readability.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/host/ohci-nxp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index 9a05828bbba1..7663f2aa35e9 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -198,7 +198,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
 	hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(hcd->regs)) {
 		ret = PTR_ERR(hcd->regs);
-		goto fail_resource;
+		goto err_put_hcd;
 	}
 	hcd->rsrc_start = res->start;
 	hcd->rsrc_len = resource_size(res);
@@ -206,7 +206,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		ret = -ENXIO;
-		goto fail_resource;
+		goto err_put_hcd;
 	}
 
 	ohci_nxp_start_hc();
@@ -220,7 +220,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
 	}
 
 	ohci_nxp_stop_hc();
-fail_resource:
+err_put_hcd:
 	usb_put_hcd(hcd);
 err_put_client:
 	put_device(&isp1301_i2c_client->dev);
-- 
2.51.2
Re: [PATCH 5/5] usb: ohci-nxp: clean up probe error labels
Posted by Alan Stern 1 month, 3 weeks ago
On Thu, Dec 18, 2025 at 03:19:45PM +0100, Johan Hovold wrote:
> Error labels should be named after what they do rather than after from
> where they are jumped to.
> 
> Rename the probe error labels for consistency and to improve
> readability.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---

Johan, in the 3/5 patch you also changed a statement label, which was 
not directly related to that patch's actual purpose, but it is directly 
related to this one's.  Can you move that rename from that patch to this 
one?

Alan Stern

>  drivers/usb/host/ohci-nxp.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
> index 9a05828bbba1..7663f2aa35e9 100644
> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -198,7 +198,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
>  	hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
>  	if (IS_ERR(hcd->regs)) {
>  		ret = PTR_ERR(hcd->regs);
> -		goto fail_resource;
> +		goto err_put_hcd;
>  	}
>  	hcd->rsrc_start = res->start;
>  	hcd->rsrc_len = resource_size(res);
> @@ -206,7 +206,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0) {
>  		ret = -ENXIO;
> -		goto fail_resource;
> +		goto err_put_hcd;
>  	}
>  
>  	ohci_nxp_start_hc();
> @@ -220,7 +220,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
>  	}
>  
>  	ohci_nxp_stop_hc();
> -fail_resource:
> +err_put_hcd:
>  	usb_put_hcd(hcd);
>  err_put_client:
>  	put_device(&isp1301_i2c_client->dev);
> -- 
> 2.51.2
>
Re: [PATCH 5/5] usb: ohci-nxp: clean up probe error labels
Posted by Johan Hovold 1 month, 3 weeks ago
On Thu, Dec 18, 2025 at 10:09:52AM -0500, Alan Stern wrote:
> On Thu, Dec 18, 2025 at 03:19:45PM +0100, Johan Hovold wrote:
> > Error labels should be named after what they do rather than after from
> > where they are jumped to.
> > 
> > Rename the probe error labels for consistency and to improve
> > readability.
> > 
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> 
> Johan, in the 3/5 patch you also changed a statement label, which was 
> not directly related to that patch's actual purpose, but it is directly 
> related to this one's.  Can you move that rename from that patch to this 
> one?

Sure. The label "fail_disable" didn't make any sense to me but looking
at the driver again now I see that it's named after the usb_disabled()
check and the rename could indeed be done as part of this patch.

I'll address this in a v2.

Johan