[Accel-config] Re: [PATCH v1] accel-config: Skip printing error if cmd status register is not set

Dave Jiang <dave.jiang at intel.com>
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
On 2/23/2021 2:14 PM, ramesh.thomas(a)intel.com wrote:
> From: Ramesh Thomas <ramesh.thomas(a)intel.com>
>
> Library functions do their own checking and return errors without
> issuing commands to the hardware. Command status register retrieved
> from "cmd_status" sysfs attribute may not be set in such cases. Return
> NULL from function that retrieves the error status to indicate this.
>
> Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
> ---
>   accfg/lib/libaccfg.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
> index ae862f8..7d5e9f4 100644
> --- a/accfg/lib/libaccfg.c
> +++ b/accfg/lib/libaccfg.c
> @@ -1469,7 +1469,7 @@ ACCFG_EXPORT const char * accfg_device_get_cmd_status_str(struct accfg_device *d
>   	const char *stat_str;
>   
>   	status = accfg_device_get_cmd_status(device);
> -	if (status < 0)
> +	if (status <= 0)

Would it be better to just return CMD_SUCCESS or something?


>   		return NULL;
>   
>   	if (status > ACCFG_CMD_STATUS_MAX)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.