> +/* ---------- pci subsystem interface ---------- */
> +
> +enum {
> +     CLEANUP_SELF_ID,
> +     CLEANUP_REGISTERS,
> +     CLEANUP_IOMEM,
> +     CLEANUP_DISABLE,
> +     CLEANUP_PUT_CARD,
> +};
> +
> +static int cleanup(struct fw_ohci *ohci, int stage, int code)
> +{
> +     struct pci_dev *dev = to_pci_dev(ohci->card.device);
> +
> +     switch (stage) {
> +     case CLEANUP_SELF_ID:
> +             dma_free_coherent(ohci->card.device, SELF_ID_BUF_SIZE,
> +                               ohci->self_id_cpu, ohci->self_id_bus);
> +     case CLEANUP_REGISTERS:
> +             kfree(ohci->it_context_list);
> +             kfree(ohci->ir_context_list);
> +             pci_iounmap(dev, ohci->registers);
> +     case CLEANUP_IOMEM:
> +             pci_release_region(dev, 0);
> +     case CLEANUP_DISABLE:
> +             pci_disable_device(dev);
> +     case CLEANUP_PUT_CARD:
> +             fw_card_put(&ohci->card);
> +     }
> +
> +     return code;
> +}
> +
> +static int __devinit
> +pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
> +{
> +     struct fw_ohci *ohci;
> +     u32 bus_options, max_receive, link_speed;
> +     u64 guid;
> +     int error_code;
> +     size_t size;
> +
> +     ohci = kzalloc(sizeof *ohci, GFP_KERNEL);
> +     if (ohci == NULL) {
> +             fw_error("Could not malloc fw_ohci data.\n");
> +             return -ENOMEM;
> +     }
> +
> +     fw_card_initialize(&ohci->card, &ohci_driver, &dev->dev);
> +
> +     if (pci_enable_device(dev)) {
> +             fw_error("Failed to enable OHCI hardware.\n");
> +             return cleanup(ohci, CLEANUP_PUT_CARD, -ENODEV);

Please use normal goto unwinding so the driver follows the same model
as almost all other pci drivers and allows people to follow your driver
more easily.  Also it's not a alot of cleanup code, so removing this
might actually be a net decrease in lines of code.

> +     if (software_reset(ohci)) {

Please give all your function a nice prefix so that oops messages are
more readable.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to