mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/5] net: introduce net_free_packet to free the packet
Date: Fri,  2 Mar 2012 19:20:07 +0100	[thread overview]
Message-ID: <1330712410-26479-2-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1330712410-26479-1-git-send-email-plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 include/net.h |    5 +++++
 net/net.c     |    6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/net.h b/include/net.h
index d0f8341..c7da380 100644
--- a/include/net.h
+++ b/include/net.h
@@ -401,6 +401,11 @@ static inline char *net_alloc_packet(void)
 	return xmemalign(32, PKTSIZE);
 }
 
+static inline void net_free_packet(void *packet)
+{
+	free(packet);
+}
+
 struct net_connection *net_udp_new(IPaddr_t dest, uint16_t dport,
 		rx_handler_f *handler, void *ctx);
 
diff --git a/net/net.c b/net/net.c
index cbcac40..07fc23a 100644
--- a/net/net.c
+++ b/net/net.c
@@ -402,7 +402,7 @@ static struct net_connection *net_new(IPaddr_t dest, rx_handler_f *handler,
 
 	return con;
 out:
-	free(con->packet);
+	net_free_packet(con->packet);
 	free(con);
 	return ERR_PTR(ret);
 }
@@ -440,7 +440,7 @@ struct net_connection *net_icmp_new(IPaddr_t dest, rx_handler_f *handler,
 void net_unregister(struct net_connection *con)
 {
 	list_del(&con->list);
-	free(con->packet);
+	net_free_packet(con->packet);
 	free(con);
 }
 
@@ -495,7 +495,7 @@ static int net_answer_arp(unsigned char *pkt, int len)
 		return 0;
 	memcpy(packet, pkt, ETHER_HDR_SIZE + ARP_HDR_SIZE);
 	eth_send(packet, ETHER_HDR_SIZE + ARP_HDR_SIZE);
-	free(packet);
+	net_free_packet(packet);
 
 	return 0;
 }
-- 
1.7.7


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-03-02 18:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02 18:20 [PATCH 1/5] net: use net_alloc_packet to allocate packet Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-03-02 18:20 ` [PATCH 3/5] net: allow the drivers to specify the tx buffer allocator Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 4/5] macb: implement alloc_packet & free_packet Jean-Christophe PLAGNIOL-VILLARD
2012-03-04 12:08   ` Sascha Hauer
2012-03-05 17:55     ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-02 18:20 ` [PATCH 5/5] macb: add timeout on send Jean-Christophe PLAGNIOL-VILLARD
2012-03-06  8:29   ` Sascha Hauer
2012-03-07  9:21     ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330712410-26479-2-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox