mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #5811 from makomi/gnrc
sys/net/gnrc: fix cppcheck errors/ warnings
This commit is contained in:
commit
9874a6d69a
@ -198,6 +198,12 @@ static inline uint16_t *_get_uint16_ptr(void *ptr)
|
|||||||
|
|
||||||
static int _send(gnrc_netdev_t *netdev, gnrc_pktsnip_t *pkt)
|
static int _send(gnrc_netdev_t *netdev, gnrc_pktsnip_t *pkt)
|
||||||
{
|
{
|
||||||
|
if ((netdev == NULL) || (netdev->driver != &_zep_driver)) {
|
||||||
|
DEBUG("zep: wrong device on sending\n");
|
||||||
|
gnrc_pktbuf_release(pkt);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
gnrc_zep_t *dev = (gnrc_zep_t *)netdev;
|
gnrc_zep_t *dev = (gnrc_zep_t *)netdev;
|
||||||
gnrc_pktsnip_t *ptr, *new_pkt, *hdr;
|
gnrc_pktsnip_t *ptr, *new_pkt, *hdr;
|
||||||
gnrc_zep_hdr_t *zep;
|
gnrc_zep_hdr_t *zep;
|
||||||
@ -205,12 +211,6 @@ static int _send(gnrc_netdev_t *netdev, gnrc_pktsnip_t *pkt)
|
|||||||
uint8_t mhr[IEEE802154_MAX_HDR_LEN], *data;
|
uint8_t mhr[IEEE802154_MAX_HDR_LEN], *data;
|
||||||
uint16_t fcs = 0;
|
uint16_t fcs = 0;
|
||||||
|
|
||||||
if ((netdev == NULL) || (netdev->driver != &_zep_driver)) {
|
|
||||||
DEBUG("zep: wrong device on sending\n");
|
|
||||||
gnrc_pktbuf_release(pkt);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create 802.15.4 header */
|
/* create 802.15.4 header */
|
||||||
hdr_len = _make_data_frame_hdr(dev, mhr, (gnrc_netif_hdr_t *)pkt->data);
|
hdr_len = _make_data_frame_hdr(dev, mhr, (gnrc_netif_hdr_t *)pkt->data);
|
||||||
|
|
||||||
|
@ -100,11 +100,12 @@ static enum gnrc_ipv6_ext_demux_status _handle_rh(gnrc_pktsnip_t *current, gnrc_
|
|||||||
static gnrc_pktsnip_t *_mark_extension_header(gnrc_pktsnip_t *current,
|
static gnrc_pktsnip_t *_mark_extension_header(gnrc_pktsnip_t *current,
|
||||||
gnrc_pktsnip_t **pkt)
|
gnrc_pktsnip_t **pkt)
|
||||||
{
|
{
|
||||||
gnrc_pktsnip_t *ext_snip, *tmp, *next;
|
gnrc_pktsnip_t *tmp, *next;
|
||||||
ipv6_ext_t *ext = (ipv6_ext_t *) current->data;
|
ipv6_ext_t *ext = (ipv6_ext_t *) current->data;
|
||||||
size_t offset = ((ext->len * IPV6_EXT_LEN_UNIT) + IPV6_EXT_LEN_UNIT);
|
size_t offset = ((ext->len * IPV6_EXT_LEN_UNIT) + IPV6_EXT_LEN_UNIT);
|
||||||
|
|
||||||
if (current == *pkt) {
|
if (current == *pkt) {
|
||||||
|
gnrc_pktsnip_t *ext_snip;
|
||||||
if ((tmp = gnrc_pktbuf_start_write(*pkt)) == NULL) {
|
if ((tmp = gnrc_pktbuf_start_write(*pkt)) == NULL) {
|
||||||
DEBUG("ipv6: could not get a copy of pkt\n");
|
DEBUG("ipv6: could not get a copy of pkt\n");
|
||||||
gnrc_pktbuf_release(*pkt);
|
gnrc_pktbuf_release(*pkt);
|
||||||
|
@ -720,7 +720,6 @@ void gnrc_rpl_send_DAO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination, uint
|
|||||||
|
|
||||||
/* add external and RPL FIB entries */
|
/* add external and RPL FIB entries */
|
||||||
for (size_t i = 0; i < gnrc_ipv6_fib_table.size; ++i) {
|
for (size_t i = 0; i < gnrc_ipv6_fib_table.size; ++i) {
|
||||||
ipv6_addr_t *addr;
|
|
||||||
fib_entry_t *fentry = &gnrc_ipv6_fib_table.data.entries[i];
|
fib_entry_t *fentry = &gnrc_ipv6_fib_table.data.entries[i];
|
||||||
if (fentry->lifetime != 0) {
|
if (fentry->lifetime != 0) {
|
||||||
if (!(fentry->next_hop_flags & FIB_FLAG_RPL_ROUTE)) {
|
if (!(fentry->next_hop_flags & FIB_FLAG_RPL_ROUTE)) {
|
||||||
@ -747,7 +746,7 @@ void gnrc_rpl_send_DAO(gnrc_rpl_instance_t *inst, ipv6_addr_t *destination, uint
|
|||||||
int_processed = true;
|
int_processed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addr = (ipv6_addr_t *) fentry->global->address;
|
ipv6_addr_t *addr = (ipv6_addr_t *) fentry->global->address;
|
||||||
if (ipv6_addr_is_global(addr)) {
|
if (ipv6_addr_is_global(addr)) {
|
||||||
size_t prefix_length = (fentry->global_flags >> FIB_FLAG_NET_PREFIX_SHIFT);
|
size_t prefix_length = (fentry->global_flags >> FIB_FLAG_NET_PREFIX_SHIFT);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user