diff options
| author | Chas Williams <chas@cmf.nrl.navy.mil> | 2003-05-29 05:58:48 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2003-05-29 05:58:48 -0700 |
| commit | 05d018c2e93e1c438c69a550591c9e0ad2acabf9 (patch) | |
| tree | b1c3c9f165929ca5c121e1b9ff1aab59e168222d | |
| parent | 79824a43bd4e72ed808eb6e6a91db9f52f05de1e (diff) | |
[ATM]: Move rategrid off stack in HE driver.
| -rw-r--r-- | drivers/atm/he.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index f25fac1978c0..3014fb0680d2 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -669,10 +669,10 @@ he_init_cs_block(struct he_dev *he_dev) } -static void __init +static int __init he_init_cs_block_rcm(struct he_dev *he_dev) { - unsigned rategrid[16][16]; + unsigned (*rategrid)[16][16]; unsigned rate, delta; int i, j, reg; @@ -680,6 +680,10 @@ he_init_cs_block_rcm(struct he_dev *he_dev) unsigned long long rate_cps; int mult, buf, buf_limit = 4; + rategrid = kmalloc( sizeof(unsigned) * 16 * 16, GFP_KERNEL); + if (!rategrid) + return -ENOMEM; + /* initialize rate grid group table */ for (reg = 0x0; reg < 0xff; ++reg) @@ -709,16 +713,16 @@ he_init_cs_block_rcm(struct he_dev *he_dev) */ for (j = 0; j < 16; j++) { - rategrid[0][j] = rate; + (*rategrid)[0][j] = rate; rate -= delta; } for (i = 1; i < 16; i++) for (j = 0; j < 16; j++) if (i > 14) - rategrid[i][j] = rategrid[i - 1][j] / 4; + (*rategrid)[i][j] = (*rategrid)[i - 1][j] / 4; else - rategrid[i][j] = rategrid[i - 1][j] / 2; + (*rategrid)[i][j] = (*rategrid)[i - 1][j] / 2; /* * 2.4 transmit internal function @@ -743,7 +747,7 @@ he_init_cs_block_rcm(struct he_dev *he_dev) rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */ for (i = 255; i > 0; i--) - if (rategrid[i/16][i%16] >= rate_cps) + if ((*rategrid)[i/16][i%16] >= rate_cps) break; /* pick nearest rate instead? */ /* @@ -780,6 +784,9 @@ he_init_cs_block_rcm(struct he_dev *he_dev) ++rate_atmf; } + + kfree(rategrid); + return 0; } static int __init @@ -1477,7 +1484,8 @@ he_start(struct atm_dev *dev) /* 5.1.8 cs block connection memory initialization */ - he_init_cs_block_rcm(he_dev); + if (he_init_cs_block_rcm(he_dev) < 0) + return -ENOMEM; /* 5.1.10 initialize host structures */ |
