[dpdk-dev] [PATCH v2] net/ring: remove unnecessary NULL check

Ferruh Yigit ferruh.yigit at intel.com
Wed Nov 2 14:15:09 CET 2016


On 11/2/2016 12:49 PM, Fulvio Risso wrote:
> Dear Ferruh,
> Maybe I'm wrong, but I cannot see your point.
> The code is absolutely the same, only the following line
> 
>     if (eth_dev->data) {
> 
> is actually removed.

Please double check the condition "rx_queues" freed:

before the patch:
==========
if (eth_dev->data) {
  internals = eth_dev->data->dev_private;
  if (internals->action == DEV_CREATE) {
    /*
     * it is only necessary to delete the rings in rx_queues because
     * they are the same used in tx_queues
     */
    for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
      r = eth_dev->data->rx_queues[i];
      rte_ring_free(r->rng);
    }
  }

  rte_free(eth_dev->data->rx_queues);
  rte_free(eth_dev->data->tx_queues);
  rte_free(eth_dev->data->dev_private);
}
==========


After the patch:
==========
internals = eth_dev->data->dev_private;
if (internals->action == DEV_CREATE) {
  /*
   * it is only necessary to delete the rings in rx_queues because
   * they are the same used in tx_queues
   */
  for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
    r = eth_dev->data->rx_queues[i];
    rte_ring_free(r->rng);
  }

  rte_free(eth_dev->data->rx_queues);
  rte_free(eth_dev->data->tx_queues);
  rte_free(eth_dev->data->dev_private);
}
==========


Thanks,
ferruh


More information about the dev mailing list