X-Git-Url: http://git.agner.ch/gitweb/?p=linux-drm-fsl-dcu.git;a=blobdiff_plain;f=net%2Firda%2Firlap.c;h=fd73e4af715a3dc82fcad5fcc771b136210a7afb;hp=a16528657b4c6a0a7e584df36e051cdcff6706ec;hb=958b7f37ee0fb2846c8d44310a68ae9605614ff9;hpb=c080a3e69dfb58ae9b8c7e70a1e33f4f4e493ea7 diff --git a/net/irda/irlap.c b/net/irda/irlap.c index a16528657b4c..fd73e4af715a 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c @@ -29,7 +29,6 @@ * ********************************************************************/ -#include #include #include #include @@ -88,7 +87,7 @@ int __init irlap_init(void) /* Allocate master array */ irlap = hashbin_new(HB_LOCK); if (irlap == NULL) { - IRDA_ERROR("%s: can't allocate irlap hashbin!\n", + IRDA_ERROR("%s: can't allocate irlap hashbin!\n", __FUNCTION__); return -ENOMEM; } @@ -117,11 +116,10 @@ struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos, IRDA_DEBUG(4, "%s()\n", __FUNCTION__); /* Initialize the irlap structure. */ - self = kmalloc(sizeof(struct irlap_cb), GFP_KERNEL); + self = kzalloc(sizeof(struct irlap_cb), GFP_KERNEL); if (self == NULL) return NULL; - memset(self, 0, sizeof(struct irlap_cb)); self->magic = LAP_MAGIC; /* Make a binding between the layers */ @@ -703,8 +701,8 @@ void irlap_update_nr_received(struct irlap_cb *self, int nr) int count = 0; /* - * Remove all the ack-ed frames from the window queue. - */ + * Remove all the ack-ed frames from the window queue. + */ /* * Optimize for the common case. It is most likely that the receiver @@ -883,7 +881,7 @@ static void irlap_change_speed(struct irlap_cb *self, __u32 speed, int now) /* Change speed now, or just piggyback speed on frames */ if (now) { /* Send down empty frame to trigger speed change */ - skb = dev_alloc_skb(0); + skb = alloc_skb(0, GFP_ATOMIC); if (skb) irlap_queue_xmit(self, skb); } @@ -1111,13 +1109,13 @@ static void *irlap_seq_start(struct seq_file *seq, loff_t *pos) spin_lock_irq(&irlap->hb_spinlock); iter->id = 0; - for (self = (struct irlap_cb *) hashbin_get_first(irlap); + for (self = (struct irlap_cb *) hashbin_get_first(irlap); self; self = (struct irlap_cb *) hashbin_get_next(irlap)) { if (iter->id == *pos) break; ++iter->id; } - + return self; } @@ -1139,7 +1137,7 @@ static int irlap_seq_show(struct seq_file *seq, void *v) { const struct irlap_iter_state *iter = seq->private; const struct irlap_cb *self = v; - + IRDA_ASSERT(self->magic == LAP_MAGIC, return -EINVAL;); seq_printf(seq, "irlap%d ", iter->id); @@ -1223,8 +1221,8 @@ static int irlap_seq_open(struct inode *inode, struct file *file) { struct seq_file *seq; int rc = -ENOMEM; - struct irlap_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); - + struct irlap_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); + if (!s) goto out; @@ -1239,7 +1237,6 @@ static int irlap_seq_open(struct inode *inode, struct file *file) seq = file->private_data; seq->private = s; - memset(s, 0, sizeof(*s)); out: return rc; out_kfree: