2002-01-21 13:18:54

by Neale Banks

[permalink] [raw]
Subject: [PATCH][2.2] eepro100 - gracefully handle init_etherdev failure

Greetings,

Appended patch against 2.2.21pre2 is for eepro100 to gracefully handle the
case where init_etherdev() returns NULL.

BTW, in testing this the unpatched eepro100 driver module apeared to get
wedged in an initialising status - is this normal?

Regards,
Neale.

--- linux-2.2.21-pre2-pristine/drivers/net/eepro100.c Mon Mar 26 02:37:34 2001
+++ linux-2.2.21-pre2-ntb/drivers/net/eepro100.c Mon Jan 21 21:40:38 2002
@@ -43,6 +43,8 @@
Changed command completion time and added debug info as to which
CMD timed out. Problem reported by:
"Ulrich Windl" <[email protected]>
+ 2002 Jan 21 Neale Banks <[email protected]>
+ Gracefully handle the case where init_etherdev() returns NULL
*/

/*#define USE_IO*/
@@ -698,6 +700,11 @@
#endif

dev = init_etherdev(NULL, sizeof(struct speedo_private));
+
+ if (dev == NULL) {
+ printk(KERN_ERR "eepro100: Unable to allocate net_device structure!\n");
+ return NULL;
+ }

if (dev->mem_start > 0)
option = dev->mem_start;