diff options
author | Shaun Ruffell <sruffell@digium.com> | 2011-06-02 20:02:08 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2011-06-02 20:02:08 +0000 |
commit | d301fe6fb22ed43d26ed3a10babb02186b56a864 (patch) | |
tree | bda09e957ab35ab90ccce3a4068e263f12de294f /drivers/dahdi/wcte12xp | |
parent | ae1d7198b2b6e9fe3095b181d23c6cd6afc3877e (diff) |
wcte12xp: kmalloc/memset -> kzalloc.
This is trivial cleanup. Fixing up a couple of places that followed a
kmalloc with a memset to 0 and also sneaked in one ARRAY_SIZE usage
change.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9947 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wcte12xp')
-rw-r--r-- | drivers/dahdi/wcte12xp/base.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index 20a1f82..fecf0e2 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -2272,7 +2272,7 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi int res; unsigned int index = -1; - for (x = 0; x < sizeof(ifaces) / sizeof(ifaces[0]); x++) { + for (x = 0; x < ARRAY_SIZE(ifaces); x++) { if (!ifaces[x]) { index = x; break; @@ -2285,12 +2285,12 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi return -EIO; } - if (!(wc = kmalloc(sizeof(*wc), GFP_KERNEL))) { + wc = kzalloc(sizeof(*wc), GFP_KERNEL); + if (!wc) return -ENOMEM; - } ifaces[index] = wc; - memset(wc, 0, sizeof(*wc)); + wc->ledstate = -1; spin_lock_init(&wc->reglock); INIT_LIST_HEAD(&wc->active_cmds); @@ -2374,18 +2374,19 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi } for (x = 0; x < (wc->spantype == TYPE_E1 ? 31 : 24); x++) { - if (!(wc->chans[x] = kmalloc(sizeof(*wc->chans[x]), GFP_KERNEL))) { + wc->chans[x] = kzalloc(sizeof(*wc->chans[x]), GFP_KERNEL); + if (!wc->chans[x]) { free_wc(wc); ifaces[index] = NULL; return -ENOMEM; } - memset(wc->chans[x], 0, sizeof(*wc->chans[x])); - if (!(wc->ec[x] = kmalloc(sizeof(*wc->ec[x]), GFP_KERNEL))) { + + wc->ec[x] = kzalloc(sizeof(*wc->ec[x]), GFP_KERNEL); + if (!wc->ec[x]) { free_wc(wc); ifaces[index] = NULL; return -ENOMEM; } - memset(wc->ec[x], 0, sizeof(*wc->ec[x])); } mod_timer(&wc->timer, jiffies + HZ/5); |