DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/2] rte_sched: remove useless bitmap_free
Date: Fri, 11 Sep 2015 17:28:15 +0000	[thread overview]
Message-ID: <3EB4FA525960D640B5BDFFD6A3D89126478BAA2E@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <1440780599-14851-3-git-send-email-stephen@networkplumber.org>



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Friday, August 28, 2015 7:50 PM
> To: Dumitrescu, Cristian
> Cc: dev@dpdk.org; Stephen Hemminger
> Subject: [PATCH 2/2] rte_sched: remove useless bitmap_free
> 
> Coverity reports that rte_bitmap_free() does nothing and caller does
> not check return value. Just remove it.
> 
> Also since rte_free(NULL) is a nop, remove useless check here.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/librte_sched/rte_bitmap.h | 19 -------------------
>  lib/librte_sched/rte_sched.c  |  5 -----
>  2 files changed, 24 deletions(-)
> 
> diff --git a/lib/librte_sched/rte_bitmap.h b/lib/librte_sched/rte_bitmap.h
> index 216a344..47eeeeb 100644
> --- a/lib/librte_sched/rte_bitmap.h
> +++ b/lib/librte_sched/rte_bitmap.h
> @@ -275,25 +275,6 @@ rte_bitmap_init(uint32_t n_bits, uint8_t *mem,
> uint32_t mem_size)
>  }
> 
>  /**
> - * Bitmap free
> - *
> - * @param bmp
> - *   Handle to bitmap instance
> - * @return
> - *   0 upon success, error code otherwise
> - */
> -static inline int
> -rte_bitmap_free(struct rte_bitmap *bmp)
> -{
> -	/* Check input arguments */
> -	if (bmp == NULL) {
> -		return -1;
> -	}
> -
> -	return 0;
> -}
> -
> -/**
>   * Bitmap reset
>   *
>   * @param bmp
> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> index 924c172..cbe3f3b 100644
> --- a/lib/librte_sched/rte_sched.c
> +++ b/lib/librte_sched/rte_sched.c
> @@ -716,11 +716,6 @@ rte_sched_port_config(struct
> rte_sched_port_params *params)
>  void
>  rte_sched_port_free(struct rte_sched_port *port)
>  {
> -	/* Check user parameters */
> -	if (port == NULL)
> -		return;
> -
> -	rte_bitmap_free(port->bmp);
>  	rte_free(port);
>  }
> 
> --
> 2.1.4

Hi Steve,

I agree these functions are not doing much at the moment, but I would like to keep them for the reasons below:

1. There might be people using them, and we do not want to break their code. Removing them is an ABI change.

2. Although they are just placeholders for now, we might need to add more functionality to them going forward, as the implementation evolves. I don't want to change the API now by removing them, and change the API later when we need to add them back. Generally, I think it is good practice to have free functions.

Regards,
Cristian

  reply	other threads:[~2015-09-11 17:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 16:49 [dpdk-dev] [PATCH 0/2] rte_sched: cleanups Stephen Hemminger
2015-08-28 16:49 ` [dpdk-dev] [PATCH 1/2] rte_sched: whitespace cleanup Stephen Hemminger
2015-09-11 17:31   ` Dumitrescu, Cristian
2015-09-11 19:18     ` Stephen Hemminger
2015-08-28 16:49 ` [dpdk-dev] [PATCH 2/2] rte_sched: remove useless bitmap_free Stephen Hemminger
2015-09-11 17:28   ` Dumitrescu, Cristian [this message]
2015-09-11 19:18     ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EB4FA525960D640B5BDFFD6A3D89126478BAA2E@IRSMSX108.ger.corp.intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).