lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 4 May 2007 12:11:25 +0100
From:	Christoph Hellwig <hch@...radead.org>
To:	Stefan Richter <stefanr@...6.in-berlin.de>
Cc:	linux-kernel@...r.kernel.org, Kristian H??gsberg <krh@...hat.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux1394-devel <linux1394-devel@...ts.sourceforge.net>,
	Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH 4/6] firewire: OHCI-1394 lowlevel driver

> +/* ---------- 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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ