accel-config: Skip printing error if cmd status register is not set
ramesh.thomas at intel.com
PATCH 1/1 accel-config: Skip printing error if cmd status register is not set
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.
--- accfg/lib/libaccfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
accfg/lib/libaccfg.c +1 -1
@@ -1469,7 +1469,7 @@ ACCFG_EXPORT const char * accfg_device_get_cmd_status_str(struct accfg_device *dconst char *stat_str; status =accfg_device_get_cmd_status (device); -if (status <0 ) +if (status <=0 )return NULL ;if (status >ACCFG_CMD_STATUS_MAX )
Signature · 1 line
2.26.2
Dave Jiang
Quoted 17 lines · ramesh.thomas(a)intel.com
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(-)accfg/lib/libaccfg.c +0
-0
accfg/lib/libaccfg.c ACCFG_EXPORT const char * accfg_device_get_cmd_status_str(struct accfg_device *d · line 1472
Quoted 5 lines
accfg/lib/libaccfg.c +1
-1@@ -1469,7 +1469,7 @@ ACCFG_EXPORT const char * accfg_device_get_cmd_status_str(struct accfg_device *dconst 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?
Quoted 3 lines
accfg/lib/libaccfg.c +0
-0return NULL ;if (status >ACCFG_CMD_STATUS_MAX )
Thomas
Quoted 21 lines · Dave Jiang
Quoted 19 lines · ramesh.thomas(a)intel.com
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(-)accfg/lib/libaccfg.c +0
-0@@ -1469,7 +1469,7 @@ ACCFG_EXPORT const char * accfg_device_get_cmd_status_str(struct accfg_device *dconst char *stat_str;
Quoted 5 lines
accfg/lib/libaccfg.c ACCFG_EXPORT const char * accfg_device_get_cmd_status_str(struct accfg_device *d · line 1472
Quoted 3 lines
accfg/lib/libaccfg.c +1
-1status =accfg_device_get_cmd_status (device); -if (status <0 ) +if (status <=0 )Would it be better to just return
CMD_SUCCESSor something?
This function returns a string error message. The calling places assume that if the string is not NULL then it is an error. They don't display the message if it is NULL. I do like the idea of it returning 0 = Success. I can make this function return only the integer error code and create another function to return the string. That way the caller can decide whether or not to display the error message if it is "Success".
Quoted 6 lines
Quoted 5 lines
accfg/lib/libaccfg.c +0
-0return NULL ;if (status >ACCFG_CMD_STATUS_MAX )
Dave Jiang
Quoted 25 lines · Ramesh
Quoted 20 lines · Dave Jiang
Quoted 19 lines · ramesh.thomas(a)intel.com
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(-)accfg/lib/libaccfg.c +0
-0@@ -1469,7 +1469,7 @@ ACCFG_EXPORT const char * accfg_device_get_cmd_status_str(struct accfg_device *dconst char *stat_str;Quoted 4 lines
accfg/lib/libaccfg.c ACCFG_EXPORT const char * accfg_device_get_cmd_status_str(struct accfg_device *d · line 1472
Quoted 3 lines
accfg/lib/libaccfg.c +1
-1status =accfg_device_get_cmd_status (device); -if (status <0 ) +if (status <=0 )Would it be better to just return
CMD_SUCCESSor something?
Quoted 6 lines
This function returns a string error message. The calling places assume that if the string is not NULL then it is an error. They don't display the message if it is NULL. I do like the idea of it returning 0 = Success. I can make this function return only the integer error code and create another function to return the string. That way the caller can decide whether or not to display the error message if it is "Success".
Sounds good!
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
accfg/lib/libaccfg.c +0
-0return NULL ;if (status >ACCFG_CMD_STATUS_MAX )