mm/iob: iob members are initialized after allocate

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2022-12-15 22:51:14 +08:00
committed by Xiang Xiao
parent 0c21bc4e53
commit 01eb4d586b
8 changed files with 7 additions and 87 deletions
@@ -231,10 +231,7 @@ static void mrf24j40_irqwork_rx(FAR struct mrf24j40_radio_s *dev)
/* Allocate an IOB to put the frame into */ /* Allocate an IOB to put the frame into */
ind->frame = iob_alloc(false); ind->frame = iob_alloc(false);
ind->frame->io_flink = NULL; DEBUGASSERT(ind->frame != NULL);
ind->frame->io_len = 0;
ind->frame->io_pktlen = 0;
ind->frame->io_offset = 0;
/* Read packet */ /* Read packet */
+4 -25
View File
@@ -163,11 +163,8 @@ static void xbee_attnworker(FAR void *arg)
/* Allocate an IOB for the incoming data. */ /* Allocate an IOB for the incoming data. */
iob = iob_alloc(false); iob = iob_alloc(false);
iob->io_flink = NULL; DEBUGASSERT(iob != NULL);
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
/* Keep a reference to the first IOB. If we need to allocate more than /* Keep a reference to the first IOB. If we need to allocate more than
* one to hold each API frame, then we will still have this reference to * one to hold each API frame, then we will still have this reference to
@@ -266,13 +263,6 @@ static void xbee_attnworker(FAR void *arg)
iob->io_flink = iob_tryalloc(false); iob->io_flink = iob_tryalloc(false);
iob = iob->io_flink; iob = iob->io_flink;
if (iob != NULL)
{
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
}
} }
else else
{ {
@@ -1324,11 +1314,8 @@ void xbee_send_apiframe(FAR struct xbee_priv_s *priv,
* data. * data.
*/ */
iob = iob_tryalloc(false); iob = iob_tryalloc(false);
iob->io_flink = NULL; DEBUGASSERT(iob != NULL);
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
/* Keep a reference to the first IOB. If we need to allocate more than /* Keep a reference to the first IOB. If we need to allocate more than
* one to hold each API frame, then we will still have this reference to * one to hold each API frame, then we will still have this reference to
@@ -1420,14 +1407,6 @@ void xbee_send_apiframe(FAR struct xbee_priv_s *priv,
iob->io_flink = iob_tryalloc(false); iob->io_flink = iob_tryalloc(false);
iob = iob->io_flink; iob = iob->io_flink;
if (iob != NULL)
{
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
}
} }
else else
{ {
@@ -1198,14 +1198,6 @@ static void spirit_interrupt_work(FAR void *arg)
{ {
priv->rxbuffer = iob_alloc(false); priv->rxbuffer = iob_alloc(false);
} }
if (priv->rxbuffer != NULL)
{
priv->rxbuffer->io_len = 0;
priv->rxbuffer->io_offset = 0;
priv->rxbuffer->io_pktlen = 0;
priv->rxbuffer->io_flink = NULL;
}
#endif #endif
} }
+1 -15
View File
@@ -183,10 +183,6 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream) void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream)
{ {
#ifdef CONFIG_SYSLOG_BUFFER
FAR struct iob_s *iob;
#endif
DEBUGASSERT(stream != NULL); DEBUGASSERT(stream != NULL);
/* Initialize the common fields */ /* Initialize the common fields */
@@ -198,17 +194,7 @@ void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream)
#ifdef CONFIG_SYSLOG_BUFFER #ifdef CONFIG_SYSLOG_BUFFER
/* Allocate an IOB */ /* Allocate an IOB */
iob = iob_tryalloc(true); stream->iob = iob_tryalloc(true);
stream->iob = iob;
if (iob != NULL)
{
/* Initialize the IOB */
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
}
#endif #endif
} }
+1 -10
View File
@@ -413,13 +413,7 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
iob = net_ioballoc(false); iob = net_ioballoc(false);
DEBUGASSERT(iob != NULL); DEBUGASSERT(iob != NULL);
/* Initialize the IOB */ fptr = iob->io_data;
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
fptr = iob->io_data;
ninfo("Sending packet length %zd\n", buflen); ninfo("Sending packet length %zd\n", buflen);
@@ -639,10 +633,7 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
/* Initialize the IOB */ /* Initialize the IOB */
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = framer_hdrlen; iob->io_offset = framer_hdrlen;
iob->io_pktlen = 0;
fptr = iob->io_data; fptr = iob->io_data;
/* Copy the HC1/HC06/IPv6 header the frame header from first /* Copy the HC1/HC06/IPv6 header the frame header from first
-10
View File
@@ -244,11 +244,6 @@ void mac802154_createdatareq(FAR struct ieee802154_privmac_s *priv,
iob = iob_alloc(false); iob = iob_alloc(false);
DEBUGASSERT(iob != NULL); DEBUGASSERT(iob != NULL);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
/* Set the frame control fields */ /* Set the frame control fields */
iob->io_data[0] = 0; iob->io_data[0] = 0;
@@ -1534,11 +1529,6 @@ static void mac802154_rxdatareq(FAR struct ieee802154_privmac_s *priv,
iob = iob_alloc(false); iob = iob_alloc(false);
DEBUGASSERT(iob != NULL); DEBUGASSERT(iob != NULL);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
iob->io_len += 2; iob->io_len += 2;
/* Cast the first two bytes of the IOB to a uint16_t frame control field */ /* Cast the first two bytes of the IOB to a uint16_t frame control field */
-10
View File
@@ -135,11 +135,6 @@ int mac802154_req_associate(MACHANDLE mac,
iob = iob_alloc(false); iob = iob_alloc(false);
DEBUGASSERT(iob != NULL); DEBUGASSERT(iob != NULL);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
/* Allocate the txdesc, waiting if necessary */ /* Allocate the txdesc, waiting if necessary */
ret = mac802154_txdesc_alloc(priv, &txdesc); ret = mac802154_txdesc_alloc(priv, &txdesc);
@@ -327,11 +322,6 @@ int mac802154_resp_associate(MACHANDLE mac,
iob = iob_alloc(false); iob = iob_alloc(false);
DEBUGASSERT(iob != NULL); DEBUGASSERT(iob != NULL);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
/* The Destination Addressing Mode and Source Addressing Mode fields shall /* The Destination Addressing Mode and Source Addressing Mode fields shall
* each be set to indicate extended addressing. * each be set to indicate extended addressing.
* *
-5
View File
@@ -511,11 +511,6 @@ static ssize_t mac802154dev_write(FAR struct file *filep,
iob = iob_alloc(false); iob = iob_alloc(false);
DEBUGASSERT(iob != NULL); DEBUGASSERT(iob != NULL);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
/* Get the MAC header length */ /* Get the MAC header length */
ret = mac802154_get_mhrlen(dev->md_mac, &tx->meta); ret = mac802154_get_mhrlen(dev->md_mac, &tx->meta);