mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 01/10] net: free packets with net_free_packet
Date: Thu,  4 Apr 2024 20:39:52 +0200	[thread overview]
Message-ID: <20240404184001.1532897-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240404184001.1532897-1-a.fatoum@pengutronix.de>

While ultimately the same (net_free_packet == dma_free == free), this
will not necessarily be always the case, so let's use the dedicated
net_free_packet function to free the packets.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 net/net.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/net.c b/net/net.c
index c06e88fe532d..2625fb8604fb 100644
--- a/net/net.c
+++ b/net/net.c
@@ -465,7 +465,7 @@ static struct net_connection *net_new(struct eth_device *edev, IPaddr_t dest,
 
 	return con;
 out:
-	free(con->packet);
+	net_free_packet(con->packet);
 	free(con);
 	return ERR_PTR(ret);
 }
@@ -510,7 +510,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);
 }
 
@@ -564,7 +564,7 @@ static int net_answer_arp(struct eth_device *edev, unsigned char *pkt, int len)
 		return 0;
 	memcpy(packet, pkt, ETHER_HDR_SIZE + ARP_HDR_SIZE);
 	ret = eth_send(edev, packet, ETHER_HDR_SIZE + ARP_HDR_SIZE);
-	free(packet);
+	net_free_packet(packet);
 
 	return ret;
 }
@@ -677,7 +677,7 @@ static int ping_reply(struct eth_device *edev, unsigned char *pkt, int len)
 
 	ret = eth_send(edev, packet, ETHER_HDR_SIZE + len);
 
-	free(packet);
+	net_free_packet(packet);
 
 	return ret;
 }
-- 
2.39.2




  reply	other threads:[~2024-04-04 18:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 18:39 [PATCH 00/10] net: fix problems handling trailing bytes Ahmad Fatoum
2024-04-04 18:39 ` Ahmad Fatoum [this message]
2024-04-04 18:39 ` [PATCH 02/10] net: ip: don't blindly trust driver supplied frame size Ahmad Fatoum
2024-04-04 18:39 ` [PATCH 03/10] net: icmp: " Ahmad Fatoum
2024-04-04 18:39 ` [PATCH 04/10] net: icmp: properly set IP TTL and fragement fields Ahmad Fatoum
2024-04-04 18:39 ` [PATCH 05/10] net: icmp: don't overrun buffer on send Ahmad Fatoum
2024-04-04 18:39 ` [PATCH 06/10] net: cpsw: report correct frame size to network stack Ahmad Fatoum
2024-04-04 18:39 ` [PATCH 07/10] net: usb: smsc95xx: don't opencode get/put_aligned_le32 Ahmad Fatoum
2024-04-04 18:39 ` [PATCH 08/10] net: usb: smsc95xx: don't blindly trust hardware size Ahmad Fatoum
2024-04-04 18:40 ` [PATCH 09/10] net: usb: smsc95xx: fix handling of multiple packets per urb Ahmad Fatoum
2024-04-05  7:18   ` [PATCH] fixup! " Ahmad Fatoum
2024-04-04 18:40 ` [PATCH 10/10] net: usb: smsc95xx: disable HW checksumming in driver Ahmad Fatoum
2024-04-04 19:49 ` [PATCH 00/10] net: fix problems handling trailing bytes Ahmad Fatoum
2024-04-05  9:57 ` Sascha Hauer

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=20240404184001.1532897-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --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