DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Mingjin Ye <mingjinx.ye@intel.com>
Cc: dev@dpdk.org
Subject: Re: [RFC] net/ice: add devargs to control link update
Date: Tue, 22 Oct 2024 08:23:22 -0700	[thread overview]
Message-ID: <20241022082322.44e0004b@hermes.local> (raw)
In-Reply-To: <20241022062043.1833554-1-mingjinx.ye@intel.com>

On Tue, 22 Oct 2024 06:20:43 +0000
Mingjin Ye <mingjinx.ye@intel.com> wrote:

> +static int
> +ice_parse_clean_subtask_period(__rte_unused const char *key,
> +		const char *value, void *args)
> +{
> +	int *num = (int *)args;
Cast of void * unnecessary in C.
You probably want period to be unsigned not signed.

> +	int tmp;
> +
> +	errno = 0;
> +	tmp = atoi(value);
> +	if (tmp < 0) {
> +		PMD_DRV_LOG(WARNING, "%s: \"%s\" is not greater than or equal to zero",
> +						key, value);
> +		return -1;
> +	}
> +
> +	*num = tmp;
> +
> +	return 0;
> +}

Prefer strtoul() when parsing values, it allows for better error handling.

  parent reply	other threads:[~2024-10-22 15:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22  6:20 Mingjin Ye
2024-10-22  6:38 ` [RFC v2] " Mingjin Ye
2024-10-22 15:23 ` Stephen Hemminger [this message]
2024-10-23  7:17   ` [RFC] " Ye, MingjinX

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=20241022082322.44e0004b@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=mingjinx.ye@intel.com \
    /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).