From: Christoph Hellwig <hch@infradead.org>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux-kernel@vger.kernel.org, Kristian H??gsberg <krh@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux1394-devel <linux1394-devel@lists.sourceforge.net>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH 4/6] firewire: OHCI-1394 lowlevel driver
Date: Fri, 4 May 2007 12:11:25 +0100 [thread overview]
Message-ID: <20070504111125.GA3028@infradead.org> (raw)
In-Reply-To: <tkrat.a41f7f10d21d3cc4@s5r6.in-berlin.de>
> +/* ---------- 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.
next prev parent reply other threads:[~2007-05-04 11:11 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-01 20:27 [git pull] New firewire stack Kristian Høgsberg
2007-05-01 21:34 ` Stefan Richter
2007-05-02 9:00 ` Christoph Hellwig
2007-05-02 12:13 ` Stefan Richter
2007-05-02 12:15 ` [PATCH 1/6] firewire: handling of cards, buses, nodes Stefan Richter
2007-05-02 12:16 ` [PATCH 2/6] firewire: isochronous and asynchronous I/O Stefan Richter
2007-05-02 12:17 ` [PATCH 3/6] firewire: char device interface Stefan Richter
2007-05-02 12:18 ` [PATCH 4/6] firewire: OHCI-1394 lowlevel driver Stefan Richter
2007-05-02 12:18 ` [PATCH 5/6] firewire: SBP-2 highlevel driver Stefan Richter
2007-05-02 12:19 ` [PATCH 6/6] firewire: add it all to kbuild Stefan Richter
2007-05-02 18:05 ` Stefan Richter
2007-05-02 19:44 ` Christoph Hellwig
2007-05-02 23:01 ` Stefan Richter
2007-05-03 4:15 ` Sam Ravnborg
2007-05-03 8:10 ` Christoph Hellwig
2007-05-08 0:14 ` Kristian Høgsberg
2007-05-02 19:44 ` [PATCH 5/6] firewire: SBP-2 highlevel driver Christoph Hellwig
2007-05-02 21:53 ` Stefan Richter
2007-05-02 22:10 ` Stefan Richter
2007-05-04 9:53 ` Christoph Hellwig
2007-05-04 11:20 ` Stefan Richter
2007-05-09 21:05 ` Kristian Høgsberg
2007-05-09 21:48 ` Stefan Richter
2007-05-09 21:57 ` Stefan Richter
2007-05-09 22:13 ` Kristian Høgsberg
2007-05-09 22:56 ` Stefan Richter
2007-05-04 11:11 ` Christoph Hellwig [this message]
2007-05-09 23:40 ` [PATCH 4/6] firewire: OHCI-1394 lowlevel driver Kristian Høgsberg
2007-05-02 15:35 ` [PATCH 3/6] firewire: char device interface John Stoffel
2007-05-02 16:06 ` Stefan Richter
2007-05-02 21:11 ` Kristian Høgsberg
2007-05-04 9:48 ` Christoph Hellwig
2007-05-08 0:19 ` Kristian Høgsberg
2007-05-02 19:30 ` Christoph Hellwig
2007-05-08 0:08 ` Kristian Høgsberg
2007-05-02 19:29 ` [PATCH 2/6] firewire: isochronous and asynchronous I/O Christoph Hellwig
2007-05-03 0:08 ` Kristian Høgsberg
2007-05-03 8:54 ` Stefan Richter
2007-05-02 15:55 ` [PATCH 1/6] firewire: handling of cards, buses, nodes Pekka Enberg
2007-05-02 19:16 ` Stefan Richter
2007-05-02 20:35 ` Pekka Enberg
2007-05-07 22:02 ` Kristian Høgsberg
2007-05-02 21:16 ` Kristian Høgsberg
2007-05-02 19:22 ` Christoph Hellwig
2007-05-07 23:42 ` Kristian Høgsberg
2007-05-02 20:00 ` [git pull] New firewire stack Kristian Høgsberg
2007-05-02 12:21 ` Olaf Hering
2007-05-02 12:48 ` Stefan Richter
2007-05-02 13:56 ` Gene Heskett
2007-05-02 18:51 ` Stefan Richter
2007-05-02 15:27 ` Adrian Bunk
2007-05-02 20:03 ` Kristian Høgsberg
2007-05-02 19:53 ` Kristian Høgsberg
2007-05-02 20:03 ` Olaf Hering
2007-05-10 17:26 ` [git pull] New firewire stack (updated) Stefan Richter
2007-05-10 17:38 ` Christoph Hellwig
2007-05-10 17:51 ` Adrian Bunk
2007-05-10 17:56 ` Stefan Richter
2007-05-10 18:05 ` Stefan Richter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070504111125.GA3028@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=krh@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=stefanr@s5r6.in-berlin.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox