linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Domen Puncer <domen@coderock.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.0-test4][Bug 976] modprobe pcnet32 (no card) then ns83820 (card present) causes oops
Date: Sun, 24 Aug 2003 13:33:58 +0200	[thread overview]
Message-ID: <200308241333.58457.domen@coderock.org> (raw)

Hi.

The problem in pcnet32 is, that it doesn't unregister pci, if there's no
hardware.

This patch solves the problem.
As Barry K. Nathan reported, it also works if you have the card.

Feedback welcome.


        Domen


--- linux-2.6.0-test4-clean/drivers/net/pcnet32.c	2003-08-24 11:42:49.000000000 +0200
+++ linux-2.6.0-test4/drivers/net/pcnet32.c	2003-08-24 11:42:38.000000000 +0200
@@ -1726,6 +1726,7 @@
 /* An additional parameter that may be passed in... */
 static int debug = -1;
 static int tx_start_pt = -1;
+static int pcnet32_have_pci;
 
 static int __init pcnet32_init_module(void)
 {
@@ -1738,7 +1739,8 @@
 	tx_start = tx_start_pt;
 
     /* find the PCI devices */
-    pci_module_init(&pcnet32_driver);
+    if (!pci_module_init(&pcnet32_driver))
+	pcnet32_have_pci = 1;
 
     /* should we find any remaining VLbus devices ? */
     if (pcnet32vlb)
@@ -1747,7 +1749,7 @@
     if (cards_found)
 	printk(KERN_INFO PFX "%d cards_found.\n", cards_found);
     
-    return cards_found ? 0 : -ENODEV;
+    return (pcnet32_have_pci + cards_found) ? 0 : -ENODEV;
 }
 
 static void __exit pcnet32_cleanup_module(void)
@@ -1765,6 +1767,9 @@
 	free_netdev(pcnet32_dev);
 	pcnet32_dev = next_dev;
     }
+
+    if (pcnet32_have_pci)
+	pci_unregister_driver(&pcnet32_driver);
 }
 
 module_init(pcnet32_init_module);


                 reply	other threads:[~2003-08-24 11:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200308241333.58457.domen@coderock.org \
    --to=domen@coderock.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).