public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tim Waugh <twaugh@redhat.com>
To: Jeff Garzik <jgarzik@mandrakesoft.mandrakesoft.com>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: [patch] 2.4.2-pre3: parport_pc init_module bug
Date: Wed, 14 Feb 2001 10:53:32 +0000	[thread overview]
Message-ID: <20010214105332.U9459@redhat.com> (raw)
In-Reply-To: <20010213234349.O9459@redhat.com> <Pine.LNX.3.96.1010214020126.28011B-100000@mandrakesoft.mandrakesoft.com>
In-Reply-To: <Pine.LNX.3.96.1010214020126.28011B-100000@mandrakesoft.mandrakesoft.com>; from jgarzik@mandrakesoft.mandrakesoft.com on Wed, Feb 14, 2001 at 02:03:07AM -0600

On Wed, Feb 14, 2001 at 02:03:07AM -0600, Jeff Garzik wrote:

> If pci_register_driver returns < 0, the driver is not registered with
> the system.

Thanks.  Okay, second try:

2001-01-14  Tim Waugh  <twaugh@redhat.com>

	* parport_pc.c: Fix PCI driver list corruption on
	unsuccessful module load (Andrew Morton).

--- linux/drivers/parport/parport_pc.c.init	Wed Feb 14 10:49:28 2001
+++ linux/drivers/parport/parport_pc.c	Wed Feb 14 10:50:31 2001
@@ -89,6 +89,7 @@
 } superios[NR_SUPERIOS] __devinitdata = { {0,},};
 
 static int user_specified __devinitdata = 0;
+static int registered_parport;
 
 /* frob_control, but for ECR */
 static void frob_econtrol (struct parport *pb, unsigned char m,
@@ -2605,8 +2606,10 @@
 	count += parport_pc_find_nonpci_ports (autoirq, autodma);
 
 	r = pci_register_driver (&parport_pc_pci_driver);
-	if (r > 0)
+	if (r >= 0) {
+		registered_parport = 1;
 		count += r;
+	}
 
 	return count;
 }
@@ -2667,6 +2670,7 @@
 	/* Work out how many ports we have, then get parport_share to parse
 	   the irq values. */
 	unsigned int i;
+	int ret;
 	for (i = 0; i < PARPORT_PC_MAX_PORTS && io[i]; i++);
 	if (i) {
 		if (parport_parse_irqs(i, irq, irqval)) return 1;
@@ -2691,7 +2695,11 @@
 			}
 	}
 
-	return !parport_pc_init (io, io_hi, irqval, dmaval);
+	ret = !parport_pc_init (io, io_hi, irqval, dmaval);
+	if (ret && registered_parport)
+		pci_unregister_driver (&parport_pc_pci_driver);
+
+	return ret;
 }
 
 void cleanup_module(void)
*** linux/drivers/parport/ChangeLog.init	Fri Jan  5 10:41:52 2001
--- linux/drivers/parport/ChangeLog	Wed Feb 14 10:50:00 2001
***************
*** 0 ****
--- 1,7 ----
+ 2001-02-14  Andrew Morton <andrewm@uow.edu.au>
+ 
+ 	* parport_pc.c (registered_parport): New static variable.
+ 	(parport_pc_find_ports): Set it when we register PCI driver.
+ 	(init_module): Unregister PCI driver if necessary when we
+ 	fail.
+ 


Tim.
*/

  parent reply	other threads:[~2001-02-14 10:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-13 23:43 [patch] 2.4.2-pre3: parport_pc init_module bug Tim Waugh
2001-02-14  8:03 ` Jeff Garzik
2001-02-14  8:53   ` James Sutherland
2001-02-14 10:53   ` Tim Waugh [this message]
2001-02-14 11:14     ` Jeff Garzik
2001-02-14 11:18       ` Tim Waugh
2001-02-14 11:21   ` Andrew Morton
2001-02-14 11:17     ` Tim Waugh
2001-02-14 11:24       ` Jeff Garzik
2001-02-14 11:40         ` Philipp Rumpf
2001-02-14 17:25           ` Grant Grundler
2001-02-14 21:12             ` Philipp Rumpf
2001-02-15  2:26               ` Grant Grundler
2001-02-18 15:05             ` Jeff Garzik
2001-02-14 11:31       ` Philipp Rumpf
2001-02-14 11:17     ` Jeff Garzik

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=20010214105332.U9459@redhat.com \
    --to=twaugh@redhat.com \
    --cc=jgarzik@mandrakesoft.mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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