Skip to contentSkip to conversation

fix sysfs leak drivers/net/dgrs.c

PATCH In review maximilian attems 2 participants 2 messages Mar 16, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix sysfs leak drivers/net/dgrs.c

if the driver fails to load, leaves a dgrs dir in sysfs.

belows patch is far from beautifull,
but keeps logic of dgrs_init_module().

test compiled.

as follow up to:
http://marc.theaimsgroup.com/?l=linux-kernel&m7938809308387&w=2

when chasing eisa_driver_register returns, i found a lot of unchecked pci_register_driver, should i add this one to kj TODO?

regards
maks

drivers/net/dgrs.c +4 -0
diff -ruN -X dontdiff linux-2.6.4/drivers/net/dgrs.c linux-2.6.4-maks/drivers/net/dgrs.c
@@ -1586,11 +1586,15 @@
 	 */
 #ifdef CONFIG_EISA
 	eisacount = eisa_driver_register(&dgrs_eisa_driver);
+	if (eisacount <= 0)
+		eisa_driver_unregister(&dgrs_eisa_driver);
 	if (eisacount < 0)
 		return eisacount;
 #endif
 #ifdef CONFIG_PCI
 	pcicount = pci_register_driver(&dgrs_pci_driver);
+	if (pcicount <= 0)
+		pci_unregister_driver(&dgrs_pci_driver);
 	if (pcicount < 0)
 		return pcicount;
 #endif

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 5 lines · maximilian attems

if the driver fails to load, leaves a dgrs dir in sysfs.

belows patch is far from beautifull,
but keeps logic of dgrs_init_module().

Quoted 8 lines

test compiled.

as follow up to:
http://marc.theaimsgroup.com/?l=linux-kernel&m7938809308387&w=2

when chasing eisa_driver_register returns, i found a lot of unchecked pci_register_driver, should i add this one to kj TODO?

Yes, and all pci_module_init() calls need to be changed to pci_register_driver() but that's a 2.7 thing...

thanks,

greg k-h
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors