X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=net%2Fatm%2Fresources.c;h=a34ba948af96dd5a471adeecd201198556e59340;hb=8294fafdafc602ed11f401c44628fab8558c5cf5;hp=de25c6408b04024e0f5f7f85b8c22564839e148b;hpb=6fa0cb1141da80eed4f86155fb51931bc1c31888;p=mv-sheeva.git diff --git a/net/atm/resources.c b/net/atm/resources.c index de25c6408b0..a34ba948af9 100644 --- a/net/atm/resources.c +++ b/net/atm/resources.c @@ -33,10 +33,9 @@ static struct atm_dev *__alloc_atm_dev(const char *type) { struct atm_dev *dev; - dev = kmalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) return NULL; - memset(dev, 0, sizeof(*dev)); dev->type = type; dev->signal = ATM_PHY_SIG_UNKNOWN; dev->link_rate = ATM_OC3_PCR; @@ -143,8 +142,8 @@ void atm_dev_deregister(struct atm_dev *dev) set_bit(ATM_DF_REMOVED, &dev->flags); /* - * if we remove current device from atm_devs list, new device - * with same number can appear, such we need deregister proc, + * if we remove current device from atm_devs list, new device + * with same number can appear, such we need deregister proc, * release async all vccs and remove them from vccs list too */ mutex_lock(&atm_dev_mutex); @@ -229,7 +228,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) *tmp_p++ = dev->number; } mutex_unlock(&atm_dev_mutex); - error = ((copy_to_user(buf, tmp_buf, size)) || + error = ((copy_to_user(buf, tmp_buf, size)) || put_user(size, &iobuf->length)) ? -EFAULT : 0; kfree(tmp_buf); @@ -248,7 +247,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) if (!(dev = try_then_request_module(atm_dev_lookup(number), "atm-device-%d", number))) return -ENODEV; - + switch (cmd) { case ATM_GETTYPE: size = strlen(dev->type) + 1; @@ -391,7 +390,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) goto done; } } - + if (size) error = put_user(size, &sioc->length) ? -EFAULT : 0; @@ -415,19 +414,20 @@ static __inline__ void *dev_get_idx(loff_t left) void *atm_dev_seq_start(struct seq_file *seq, loff_t *pos) { - mutex_lock(&atm_dev_mutex); - return *pos ? dev_get_idx(*pos) : (void *) 1; + mutex_lock(&atm_dev_mutex); + return *pos ? dev_get_idx(*pos) : SEQ_START_TOKEN; } void atm_dev_seq_stop(struct seq_file *seq, void *v) { - mutex_unlock(&atm_dev_mutex); + mutex_unlock(&atm_dev_mutex); } - + void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) { ++*pos; - v = (v == (void *)1) ? atm_devs.next : ((struct list_head *)v)->next; + v = (v == SEQ_START_TOKEN) + ? atm_devs.next : ((struct list_head *)v)->next; return (v == &atm_devs) ? NULL : v; }