[PATCH v10 2/6] power: refactor uncore power management library

Stephen Hemminger stephen at networkplumber.org
Sat Nov 16 01:55:41 CET 2024


On Mon, 28 Oct 2024 19:55:52 +0000
Sivaprasad Tummala <sivaprasad.tummala at amd.com> wrote:

> +	/* Auto Detect Environment */
> +	RTE_TAILQ_FOREACH(ops, &uncore_ops_list, next)
> +		if (ops) {
> +			POWER_LOG(INFO,
> +				"Attempting to initialise %s power management...",
> +				ops->name);
> +			ret = ops->init(pkg, die);
> +			if (ret == 0) {
> +				for (env = 0; env < RTE_DIM(uncore_env_str); env++)
> +					if (strncmp(ops->name, uncore_env_str[env],
> +						RTE_POWER_UNCORE_DRIVER_NAMESZ) == 0) {
> +						rte_power_set_uncore_env(env);
> +						goto out;
> +					}
> +			}
> +		}
>  out:

Static analyzer complains:
lib/power/rte_power_uncore.c:113:1: warning: V547 Expression 'ops' is always true.

Since the macro RTE_TAILQ_FOREACH() iterates until ops is NULL, that whole if() part
can be removed.


More information about the dev mailing list