Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 485fb2c9 authored by Samuel Ortiz's avatar Samuel Ortiz Committed by David S. Miller
Browse files

[IrDA]: Use alloc_skb() in IrDA TX path



As pointed out by Christoph Hellwig, dev_alloc_skb() is not intended to be
used for allocating TX sk_buff. The IrDA stack was exclusively calling
dev_alloc_skb() on the TX path, and this patch fixes that.

Signed-off-by: default avatarSamuel Ortiz <samuel@sortiz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b8263158
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ static void irda_connect_response(struct irda_sock *self)

	IRDA_ASSERT(self != NULL, return;);

	skb = dev_alloc_skb(64);
	skb = alloc_skb(64, GFP_ATOMIC);
	if (skb == NULL) {
		IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n",
			   __FUNCTION__);
+2 −2
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ static int ircomm_lmp_connect_response(struct ircomm_cb *self,
	
	/* Any userdata supplied? */
	if (userdata == NULL) {
		tx_skb = dev_alloc_skb(64);
		tx_skb = alloc_skb(64, GFP_ATOMIC);
		if (!tx_skb)
			return -ENOMEM;

@@ -115,7 +115,7 @@ static int ircomm_lmp_disconnect_request(struct ircomm_cb *self,
	IRDA_DEBUG(0, "%s()\n", __FUNCTION__ );

        if (!userdata) {
		tx_skb = dev_alloc_skb(64);
		tx_skb = alloc_skb(64, GFP_ATOMIC);
		if (!tx_skb)
			return -ENOMEM;
		
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush)

	skb = self->ctrl_skb;	
	if (!skb) {
		skb = dev_alloc_skb(256);
		skb = alloc_skb(256, GFP_ATOMIC);
		if (!skb) {
			spin_unlock_irqrestore(&self->spinlock, flags);
			return -ENOMEM;
+3 −2
Original line number Diff line number Diff line
@@ -759,8 +759,9 @@ static int ircomm_tty_write(struct tty_struct *tty,
			}
		} else {
			/* Prepare a full sized frame */
			skb = dev_alloc_skb(self->max_data_size+
					    self->max_header_size);
			skb = alloc_skb(self->max_data_size+
					self->max_header_size,
					GFP_ATOMIC);
			if (!skb) {
				spin_unlock_irqrestore(&self->spinlock, flags);
				return -ENOBUFS;
+5 −4
Original line number Diff line number Diff line
@@ -345,7 +345,7 @@ static void iriap_disconnect_request(struct iriap_cb *self)
	IRDA_ASSERT(self != NULL, return;);
	IRDA_ASSERT(self->magic == IAS_MAGIC, return;);

	tx_skb = dev_alloc_skb(64);
	tx_skb = alloc_skb(64, GFP_ATOMIC);
	if (tx_skb == NULL) {
		IRDA_DEBUG(0, "%s(), Could not allocate an sk_buff of length %d\n", 
			__FUNCTION__, 64);
@@ -396,7 +396,7 @@ int iriap_getvaluebyclass_request(struct iriap_cb *self,
	attr_len = strlen(attr);	/* Up to IAS_MAX_ATTRIBNAME = 60 */

	skb_len = self->max_header_size+2+name_len+1+attr_len+4;
	tx_skb = dev_alloc_skb(skb_len);
	tx_skb = alloc_skb(skb_len, GFP_ATOMIC);
	if (!tx_skb)
		return -ENOMEM;

@@ -562,7 +562,8 @@ static void iriap_getvaluebyclass_response(struct iriap_cb *self,
	 *  value. We add 32 bytes because of the 6 bytes for the frame and
	 *  max 5 bytes for the value coding.
	 */
	tx_skb = dev_alloc_skb(value->len + self->max_header_size + 32);
	tx_skb = alloc_skb(value->len + self->max_header_size + 32,
			   GFP_ATOMIC);
	if (!tx_skb)
		return;

@@ -700,7 +701,7 @@ void iriap_send_ack(struct iriap_cb *self)
	IRDA_ASSERT(self != NULL, return;);
	IRDA_ASSERT(self->magic == IAS_MAGIC, return;);

	tx_skb = dev_alloc_skb(64);
	tx_skb = alloc_skb(64, GFP_ATOMIC);
	if (!tx_skb)
		return;

Loading