lkml.org 
[lkml]   [2001]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [CHECKER] 2.4.5-ac4 non-init functions calling init functions
On Wed, 30 May 2001, Dawson Engler wrote:

> Here are *uninspected* 2.4.5-ac4 results of a checker that warns when a
> non-__init function calls an __init function (suggested by
> jlundell@lobitos.net). There seem to be two cases:

> /u2/engler/mc/oses/linux/2.4.5-ac4/drivers/isdn/hisax/avm_pci.c:746:AVM_card_msg: ERROR:INIT: non-init fn 'AVM_card_msg' calling init fn 'inithdlc'
> /u2/engler/mc/oses/linux/2.4.5-ac4/drivers/isdn/hisax/avm_pci.c:745:AVM_card_msg: ERROR:INIT: non-init fn 'AVM_card_msg' calling init fn 'clear_pending_hdlc_ints'
> /u2/engler/mc/oses/linux/2.4.5-ac4/drivers/isdn/hisax/hfc_pci.c:1665:hfcpci_card_msg: ERROR:INIT: non-init fn 'hfcpci_card_msg' calling init fn 'inithfcpci'
> /u2/engler/mc/oses/linux/2.4.5-ac4/drivers/isdn/hisax/w6692.c:950:w6692_card_msg: ERROR:INIT: non-init fn 'w6692_card_msg' calling init fn 'initW6692'

These are actually false positives. The offending __init functions are
only called, when the _card_msg function is called with "CARD_INIT". This
only happens from __devinit code in config.c.

Now, calling __init from __devinit would a bug, too. However, the driver
doesn't support hotplug PCI, but the affected cards are PCI, so no problem
there, either.

> /u2/engler/mc/oses/linux/2.4.5-ac4/drivers/isdn/hisax/gazel.c:565:setup_gazelpci: ERROR:INIT: non-init fn 'setup_gazelpci' using init data 'dev_tel'
> /u2/engler/mc/oses/linux/2.4.5-ac4/drivers/isdn/hisax/gazel.c:568:setup_gazelpci: ERROR:INIT: non-init fn 'setup_gazelpci' using init data 'dev_tel'
> /u2/engler/mc/oses/linux/2.4.5-ac4/drivers/isdn/hisax/gazel.c:570:setup_gazelpci: ERROR:INIT: non-init fn 'setup_gazelpci' using init data 'dev_tel'
> /u2/engler/mc/oses/linux/2.4.5-ac4/drivers/isdn/hisax/gazel.c:569:setup_gazelpci: ERROR:INIT: non-init fn 'setup_gazelpci' using init data 'dev_tel'

These are actual (performance) bugs.
Patch is appended.

BTW: I don't if you did so already, but if you extended the checker to
find functions which are only called from __init functions, but not
marked __init themselves, you'd most likely find lots more performance
bugs of this kind.

Thank you,
--Kai

Index: linux_2_4/drivers/isdn/hisax//gazel.c
===================================================================
RCS file: /scratch/kai/cvsroot/linux_2_4/drivers/isdn/hisax/gazel.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 gazel.c
--- linux_2_4/drivers/isdn/hisax//gazel.c 2001/04/23 22:51:01 1.1.1.2
+++ linux_2_4/drivers/isdn/hisax//gazel.c 2001/05/31 21:35:39
@@ -1,4 +1,4 @@
-/* $Id: gazel.c,v 2.11.6.4 2001/02/16 16:43:26 kai Exp $
+/* $Id: gazel.c,v 2.11.6.5 2001/05/31 21:34:36 kai Exp $
*
* gazel.c low level stuff for Gazel isdn cards
*
@@ -19,7 +19,7 @@
#include <linux/pci.h>

extern const char *CardType[];
-const char *gazel_revision = "$Revision: 2.11.6.4 $";
+const char *gazel_revision = "$Revision: 2.11.6.5 $";

#define R647 1
#define R685 2
@@ -497,7 +497,7 @@
return 1;
}

-static int
+static int __init
setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
{
printk(KERN_INFO "Gazel: ISA PnP card automatic recognition\n");
@@ -546,7 +546,7 @@

static struct pci_dev *dev_tel __initdata = NULL;

-static int
+static int __init
setup_gazelpci(struct IsdnCardState *cs)
{
u_int pci_ioaddr0 = 0, pci_ioaddr1 = 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:17    [from the cache]
©2003-2011 Jasper Spaans