Commit 8397703e authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab

V4L/DVB (4014): Remove the spagetti code gotos that aren't useful

Some code had pointless gotos that just didn't make any sense.  They didn't
make the code smaller, or faster, or easier to understand.
Signed-off-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarAndrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 19b7ad31
...@@ -242,19 +242,16 @@ static int flexcop_pci_dma_init(struct flexcop_pci *fc_pci) ...@@ -242,19 +242,16 @@ static int flexcop_pci_dma_init(struct flexcop_pci *fc_pci)
if ((ret = flexcop_dma_allocate(fc_pci->pdev,&fc_pci->dma[0],FC_DEFAULT_DMA1_BUFSIZE)) != 0) if ((ret = flexcop_dma_allocate(fc_pci->pdev,&fc_pci->dma[0],FC_DEFAULT_DMA1_BUFSIZE)) != 0)
return ret; return ret;
if ((ret = flexcop_dma_allocate(fc_pci->pdev,&fc_pci->dma[1],FC_DEFAULT_DMA2_BUFSIZE)) != 0) if ((ret = flexcop_dma_allocate(fc_pci->pdev,&fc_pci->dma[1],FC_DEFAULT_DMA2_BUFSIZE)) != 0) {
goto dma1_free; flexcop_dma_free(&fc_pci->dma[0]);
return ret;
}
flexcop_sram_set_dest(fc_pci->fc_dev,FC_SRAM_DEST_MEDIA | FC_SRAM_DEST_NET, FC_SRAM_DEST_TARGET_DMA1); flexcop_sram_set_dest(fc_pci->fc_dev,FC_SRAM_DEST_MEDIA | FC_SRAM_DEST_NET, FC_SRAM_DEST_TARGET_DMA1);
flexcop_sram_set_dest(fc_pci->fc_dev,FC_SRAM_DEST_CAO | FC_SRAM_DEST_CAI, FC_SRAM_DEST_TARGET_DMA2); flexcop_sram_set_dest(fc_pci->fc_dev,FC_SRAM_DEST_CAO | FC_SRAM_DEST_CAI, FC_SRAM_DEST_TARGET_DMA2);
fc_pci->init_state |= FC_PCI_DMA_INIT; fc_pci->init_state |= FC_PCI_DMA_INIT;
goto success;
dma1_free:
flexcop_dma_free(&fc_pci->dma[0]);
success:
return ret; return ret;
} }
...@@ -303,7 +300,7 @@ static int flexcop_pci_init(struct flexcop_pci *fc_pci) ...@@ -303,7 +300,7 @@ static int flexcop_pci_init(struct flexcop_pci *fc_pci)
spin_lock_init(&fc_pci->irq_lock); spin_lock_init(&fc_pci->irq_lock);
fc_pci->init_state |= FC_PCI_INIT; fc_pci->init_state |= FC_PCI_INIT;
goto success; return ret;
err_pci_iounmap: err_pci_iounmap:
pci_iounmap(fc_pci->pdev, fc_pci->io_mem); pci_iounmap(fc_pci->pdev, fc_pci->io_mem);
...@@ -312,8 +309,6 @@ static int flexcop_pci_init(struct flexcop_pci *fc_pci) ...@@ -312,8 +309,6 @@ static int flexcop_pci_init(struct flexcop_pci *fc_pci)
pci_release_regions(fc_pci->pdev); pci_release_regions(fc_pci->pdev);
err_pci_disable_device: err_pci_disable_device:
pci_disable_device(fc_pci->pdev); pci_disable_device(fc_pci->pdev);
success:
return ret; return ret;
} }
...@@ -378,14 +373,14 @@ static int flexcop_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -378,14 +373,14 @@ static int flexcop_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
INIT_WORK(&fc_pci->irq_check_work, flexcop_pci_irq_check_work, fc_pci); INIT_WORK(&fc_pci->irq_check_work, flexcop_pci_irq_check_work, fc_pci);
goto success; return ret;
err_fc_exit: err_fc_exit:
flexcop_device_exit(fc); flexcop_device_exit(fc);
err_pci_exit: err_pci_exit:
flexcop_pci_exit(fc_pci); flexcop_pci_exit(fc_pci);
err_kfree: err_kfree:
flexcop_device_kfree(fc); flexcop_device_kfree(fc);
success:
return ret; return ret;
} }
......
...@@ -433,11 +433,10 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb) ...@@ -433,11 +433,10 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)
flexcop_wan_set_speed(fc_usb->fc_dev,FC_WAN_SPEED_8MBITS); flexcop_wan_set_speed(fc_usb->fc_dev,FC_WAN_SPEED_8MBITS);
flexcop_sram_ctrl(fc_usb->fc_dev,1,1,1); flexcop_sram_ctrl(fc_usb->fc_dev,1,1,1);
ret = 0; return 0;
goto success;
urb_error: urb_error:
flexcop_usb_transfer_exit(fc_usb); flexcop_usb_transfer_exit(fc_usb);
success:
return ret; return ret;
} }
...@@ -515,15 +514,14 @@ static int flexcop_usb_probe(struct usb_interface *intf, ...@@ -515,15 +514,14 @@ static int flexcop_usb_probe(struct usb_interface *intf,
goto err_fc_exit; goto err_fc_exit;
info("%s successfully initialized and connected.",DRIVER_NAME); info("%s successfully initialized and connected.",DRIVER_NAME);
ret = 0; return 0;
goto success;
err_fc_exit: err_fc_exit:
flexcop_device_exit(fc); flexcop_device_exit(fc);
err_usb_exit: err_usb_exit:
flexcop_usb_exit(fc_usb); flexcop_usb_exit(fc_usb);
err_kfree: err_kfree:
flexcop_device_kfree(fc); flexcop_device_kfree(fc);
success:
return ret; return ret;
} }
......
...@@ -116,7 +116,7 @@ static int flexcop_dvb_init(struct flexcop_device *fc) ...@@ -116,7 +116,7 @@ static int flexcop_dvb_init(struct flexcop_device *fc)
dvb_net_init(&fc->dvb_adapter, &fc->dvbnet, &fc->demux.dmx); dvb_net_init(&fc->dvb_adapter, &fc->dvbnet, &fc->demux.dmx);
fc->init_state |= FC_STATE_DVB_INIT; fc->init_state |= FC_STATE_DVB_INIT;
goto success; return 0;
err_connect_frontend: err_connect_frontend:
fc->demux.dmx.remove_frontend(&fc->demux.dmx,&fc->mem_frontend); fc->demux.dmx.remove_frontend(&fc->demux.dmx,&fc->mem_frontend);
...@@ -129,9 +129,6 @@ static int flexcop_dvb_init(struct flexcop_device *fc) ...@@ -129,9 +129,6 @@ static int flexcop_dvb_init(struct flexcop_device *fc)
err_dmx: err_dmx:
dvb_unregister_adapter(&fc->dvb_adapter); dvb_unregister_adapter(&fc->dvb_adapter);
return ret; return ret;
success:
return 0;
} }
static void flexcop_dvb_exit(struct flexcop_device *fc) static void flexcop_dvb_exit(struct flexcop_device *fc)
...@@ -279,11 +276,10 @@ int flexcop_device_initialize(struct flexcop_device *fc) ...@@ -279,11 +276,10 @@ int flexcop_device_initialize(struct flexcop_device *fc)
flexcop_device_name(fc,"initialization of","complete"); flexcop_device_name(fc,"initialization of","complete");
ret = 0; return 0;
goto success;
error: error:
flexcop_device_exit(fc); flexcop_device_exit(fc);
success:
return ret; return ret;
} }
EXPORT_SYMBOL(flexcop_device_initialize); EXPORT_SYMBOL(flexcop_device_initialize);
......
...@@ -168,11 +168,9 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) ...@@ -168,11 +168,9 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d)
state->frontend.ops = &state->ops; state->frontend.ops = &state->ops;
state->frontend.demodulator_priv = state; state->frontend.demodulator_priv = state;
goto success; return &state->frontend;
error: error:
return NULL; return NULL;
success:
return &state->frontend;
} }
static struct dvb_frontend_ops dtt200u_fe_ops = { static struct dvb_frontend_ops dtt200u_fe_ops = {
......
...@@ -121,16 +121,15 @@ int dvb_usb_dvb_init(struct dvb_usb_device *d) ...@@ -121,16 +121,15 @@ int dvb_usb_dvb_init(struct dvb_usb_device *d)
dvb_net_init(&d->dvb_adap, &d->dvb_net, &d->demux.dmx); dvb_net_init(&d->dvb_adap, &d->dvb_net, &d->demux.dmx);
goto success; d->state |= DVB_USB_STATE_DVB;
return 0;
err_dmx_dev: err_dmx_dev:
dvb_dmx_release(&d->demux); dvb_dmx_release(&d->demux);
err_dmx: err_dmx:
dvb_unregister_adapter(&d->dvb_adap); dvb_unregister_adapter(&d->dvb_adap);
err: err:
return ret; return ret;
success:
d->state |= DVB_USB_STATE_DVB;
return 0;
} }
int dvb_usb_dvb_exit(struct dvb_usb_device *d) int dvb_usb_dvb_exit(struct dvb_usb_device *d)
......
...@@ -293,11 +293,9 @@ struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) ...@@ -293,11 +293,9 @@ struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d)
s->lnb_buf[1] = SET_LNB_POWER; s->lnb_buf[1] = SET_LNB_POWER;
s->lnb_buf[3] = 0xff; /* 0=tone burst, 2=data burst, ff=off */ s->lnb_buf[3] = 0xff; /* 0=tone burst, 2=data burst, ff=off */
goto success; return &s->fe;
error: error:
return NULL; return NULL;
success:
return &s->fe;
} }
......
...@@ -155,11 +155,9 @@ struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) ...@@ -155,11 +155,9 @@ struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d)
s->fe.ops = &s->ops; s->fe.ops = &s->ops;
s->fe.demodulator_priv = s; s->fe.demodulator_priv = s;
goto success; return &s->fe;
error: error:
return NULL; return NULL;
success:
return &s->fe;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment