patch-2.3.99-pre6 linux/drivers/atm/horizon.c
Next file: linux/drivers/atm/uPD98402.c
Previous file: linux/drivers/atm/fore200e.h
Back to the patch index
Back to the overall index
- Lines: 48
- Date:
Fri Apr 14 09:37:10 2000
- Orig file:
v2.3.99-pre5/linux/drivers/atm/horizon.c
- Orig date:
Mon Mar 27 08:08:23 2000
diff -u --recursive --new-file v2.3.99-pre5/linux/drivers/atm/horizon.c linux/drivers/atm/horizon.c
@@ -2490,10 +2490,15 @@
return -EINVAL;
}
+ // prevent module unload while sleeping (kmalloc)
+ // doing this any earlier would complicate more error return paths
+ MOD_INC_USE_COUNT;
+
// get space for our vcc stuff and copy parameters into it
vccp = kmalloc (sizeof(hrz_vcc), GFP_KERNEL);
if (!vccp) {
PRINTK (KERN_ERR, "out of memory!");
+ MOD_DEC_USE_COUNT;
return -ENOMEM;
}
*vccp = vcc;
@@ -2525,6 +2530,7 @@
if (error) {
PRINTD (DBG_QOS|DBG_VCC, "insufficient cell rate resources");
kfree (vccp);
+ MOD_DEC_USE_COUNT;
return error;
}
@@ -2537,11 +2543,13 @@
if (rxtp->traffic_class != ATM_NONE) {
if (dev->rxer[channel]) {
PRINTD (DBG_ERR|DBG_VCC, "VC already open for RX");
- return -EBUSY;
+ error = -EBUSY;
}
- error = hrz_open_rx (dev, channel);
+ if (!error)
+ error = hrz_open_rx (dev, channel);
if (error) {
kfree (vccp);
+ MOD_DEC_USE_COUNT;
return error;
}
// this link allows RX frames through
@@ -2556,7 +2564,6 @@
// indicate readiness
set_bit(ATM_VF_READY,&atm_vcc->flags);
- MOD_INC_USE_COUNT;
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)