Re: [PATCH 1/2] usb: hso: fix error handling code of hso_create_net_device

From: Dan Carpenter
Date: Wed Jul 14 2021 - 04:31:46 EST


On Wed, Jul 14, 2021 at 04:14:18PM +0800, Dongliang Mu wrote:
> > @@ -2523,18 +2523,18 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
> > for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
> > hso_net->mux_bulk_rx_urb_pool[i] = usb_alloc_urb(0, GFP_KERNEL);
> > if (!hso_net->mux_bulk_rx_urb_pool[i])
> > - goto exit;
> > + goto err_mux_bulk_rx;
> > hso_net->mux_bulk_rx_buf_pool[i] = kzalloc(MUX_BULK_RX_BUF_SIZE,
> > GFP_KERNEL);
> > if (!hso_net->mux_bulk_rx_buf_pool[i])
> > - goto exit;
> > + goto err_mux_bulk_rx;
> > }
> > hso_net->mux_bulk_tx_urb = usb_alloc_urb(0, GFP_KERNEL);
> > if (!hso_net->mux_bulk_tx_urb)
> > - goto exit;
> > + goto err_mux_bulk_rx;
> > hso_net->mux_bulk_tx_buf = kzalloc(MUX_BULK_TX_BUF_SIZE, GFP_KERNEL);
> > if (!hso_net->mux_bulk_tx_buf)
> > - goto exit;
> > + goto err_mux_bulk_tx;

I would probably have called this err free_tx_urb or something like
that.

> >
> > add_net_device(hso_dev);
> >
> > @@ -2542,7 +2542,7 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
> > result = register_netdev(net);
> > if (result) {
> > dev_err(&interface->dev, "Failed to register device\n");
> > - goto exit;
> > + goto err_register;

This is still Come From style. I wouldn't have commented except that
you said you are giong to redo the patch for other reasons.

It looks good. Straight forward to review now.

regards,
dan carpenter