What is this code doing (why query link status)?

static uint16_t
eth_memif_rx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
{
...
        struct rte_eth_link link;

        if (unlikely((pmd->flags & ETH_MEMIF_FLAG_CONNECTED) == 0))
                return 0;

        if (unlikely(ring == NULL)) {
                /* Secondary process will attempt to request regions. */
                rte_eth_link_get(mq->in_port, &link);  <<< Why??
                return 0;
        }

It causes Coverity warning:
*** CID 351057:  Error handling issues  (CHECKED_RETURN)
/drivers/net/memif/rte_eth_memif.c: 436 in eth_memif_rx_zc()
430             struct rte_eth_link link;
431     
432             if (unlikely((pmd->flags & ETH_MEMIF_FLAG_CONNECTED) == 0))
433                     return 0;
434             if (unlikely(ring == NULL)) {
435                     /* Secondary process will attempt to request regions. */
>>>     CID 351057:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "rte_eth_link_get" without checking return value (as is done 
>>> elsewhere 14 out of 17 times).  
436                     rte_eth_link_get(mq->in_port, &link);
437                     return 0;
438             }
439     
440             /* consume interrupt */
441             if ((ring->flags & MEMIF_RING_FLAG_MASK_INT) == 0) {

Reply via email to