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

View File

@ -231,10 +231,7 @@ static void mrf24j40_irqwork_rx(FAR struct mrf24j40_radio_s *dev)
/* Allocate an IOB to put the frame into */
ind->frame = iob_alloc(false);
ind->frame->io_flink = NULL;
ind->frame->io_len = 0;
ind->frame->io_pktlen = 0;
ind->frame->io_offset = 0;
DEBUGASSERT(ind->frame != NULL);
/* Read packet */

View File

@ -163,11 +163,8 @@ static void xbee_attnworker(FAR void *arg)
/* Allocate an IOB for the incoming data. */
iob = iob_alloc(false);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
iob = iob_alloc(false);
DEBUGASSERT(iob != NULL);
/* 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
@ -266,13 +263,6 @@ static void xbee_attnworker(FAR void *arg)
iob->io_flink = iob_tryalloc(false);
iob = iob->io_flink;
if (iob != NULL)
{
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
}
}
else
{
@ -1324,11 +1314,8 @@ void xbee_send_apiframe(FAR struct xbee_priv_s *priv,
* data.
*/
iob = iob_tryalloc(false);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
iob = iob_tryalloc(false);
DEBUGASSERT(iob != NULL);
/* 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
@ -1420,14 +1407,6 @@ void xbee_send_apiframe(FAR struct xbee_priv_s *priv,
iob->io_flink = iob_tryalloc(false);
iob = iob->io_flink;
if (iob != NULL)
{
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
}
}
else
{

View File

@ -1198,14 +1198,6 @@ static void spirit_interrupt_work(FAR void *arg)
{
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
}

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)
{
#ifdef CONFIG_SYSLOG_BUFFER
FAR struct iob_s *iob;
#endif
DEBUGASSERT(stream != NULL);
/* Initialize the common fields */
@ -198,17 +194,7 @@ void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream)
#ifdef CONFIG_SYSLOG_BUFFER
/* Allocate an IOB */
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;
}
stream->iob = iob_tryalloc(true);
#endif
}

View File

@ -413,13 +413,7 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
iob = net_ioballoc(false);
DEBUGASSERT(iob != NULL);
/* Initialize the IOB */
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
fptr = iob->io_data;
fptr = iob->io_data;
ninfo("Sending packet length %zd\n", buflen);
@ -639,10 +633,7 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
/* Initialize the IOB */
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = framer_hdrlen;
iob->io_pktlen = 0;
fptr = iob->io_data;
/* Copy the HC1/HC06/IPv6 header the frame header from first

View File

@ -244,11 +244,6 @@ void mac802154_createdatareq(FAR struct ieee802154_privmac_s *priv,
iob = iob_alloc(false);
DEBUGASSERT(iob != NULL);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
/* Set the frame control fields */
iob->io_data[0] = 0;
@ -1534,11 +1529,6 @@ static void mac802154_rxdatareq(FAR struct ieee802154_privmac_s *priv,
iob = iob_alloc(false);
DEBUGASSERT(iob != NULL);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
iob->io_len += 2;
/* Cast the first two bytes of the IOB to a uint16_t frame control field */

View File

@ -135,11 +135,6 @@ int mac802154_req_associate(MACHANDLE mac,
iob = iob_alloc(false);
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 */
ret = mac802154_txdesc_alloc(priv, &txdesc);
@ -327,11 +322,6 @@ int mac802154_resp_associate(MACHANDLE mac,
iob = iob_alloc(false);
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
* each be set to indicate extended addressing.
*

View File

@ -511,11 +511,6 @@ static ssize_t mac802154dev_write(FAR struct file *filep,
iob = iob_alloc(false);
DEBUGASSERT(iob != NULL);
iob->io_flink = NULL;
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
/* Get the MAC header length */
ret = mac802154_get_mhrlen(dev->md_mac, &tx->meta);