This fixes a bug when renaming multiple wireless cards on slow devices.
The pci registration causes udev to rename the device but the sysctl is
not registered yet so the device renames but the corresponding sysctl
entries are not renamed.
git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3746
0192ed92-7a03-0410-a25b-
9323aeb14dbd
unsigned int i, space;
char *dev_name = NULL;
+ /* Prevent multiple registrations */
+ if (sc->sc_sysctls)
+ return;
+
space = 5 * sizeof(struct ctl_table) + sizeof(ath_sysctl_template);
sc->sc_sysctls = kzalloc(space, GFP_KERNEL);
if (sc->sc_sysctls == NULL) {
dev_name = kmalloc((strlen(DEV_NAME(sc->sc_dev)) + 1) * sizeof(char), GFP_KERNEL);
if (dev_name == NULL) {
EPRINTF(sc, "Insufficient memory for device name storage!\n");
+ kfree(sc->sc_sysctls);
+ sc->sc_sysctls = NULL;
return;
}
strncpy(dev_name, DEV_NAME(sc->sc_dev), strlen(DEV_NAME(sc->sc_dev)) + 1);
static int __init
init_ath_pci(void)
{
- int status = pci_register_driver(&ath_pci_driver);
- if (status)
- return (status);
+ int status;
ath_sysctl_register();
+ if ((status = pci_register_driver(&ath_pci_driver))) {
+ ath_sysctl_unregister();
+ return (status);
+ }
return (0);
}
module_init(init_ath_pci);