summaryrefslogtreecommitdiff
path: root/examples/vm_power_manager
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2014-12-16 15:03:52 +0000
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-12-17 01:04:06 +0100
commit5b628fe19a8c4693c4e1d5859418d8b16991c0cf (patch)
tree6fef6e0a7109ed7d529d9e3e5267f36fd3187bed /examples/vm_power_manager
parent0d74597c1b4ff660b3fb6cd97c7d86643d42065b (diff)
downloaddpdk-5b628fe19a8c4693c4e1d5859418d8b16991c0cf.zip
dpdk-5b628fe19a8c4693c4e1d5859418d8b16991c0cf.tar.gz
dpdk-5b628fe19a8c4693c4e1d5859418d8b16991c0cf.tar.xz
examples/vm_power: fix check for null
The check for NULL is in the wrong position in the "if" error leg. The pointer should be checked for NULL before checking what the value of what the pointer points to is. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Diffstat (limited to 'examples/vm_power_manager')
-rw-r--r--examples/vm_power_manager/channel_manager.c2
-rw-r--r--examples/vm_power_manager/vm_power_cli.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index 34a395d..04344ae 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -389,7 +389,7 @@ add_all_channels(const char *vm_name)
errno = 0;
channel_num = (unsigned)strtol(remaining, &tail_ptr, 0);
if ((errno != 0) || (remaining[0] == '\0') ||
- (*tail_ptr != '\0') || tail_ptr == NULL) {
+ tail_ptr == NULL || (*tail_ptr != '\0')) {
RTE_LOG(WARNING, CHANNEL_MANAGER, "Malformed channel name"
"'%s' found it should be in the form of "
"'<guest_name>.<channel_num>(decimal)'\n",
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index e7f4469..bd685fd 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -323,7 +323,7 @@ cmd_channels_op_parsed(void *parsed_result, struct cmdline *cl,
break;
errno = 0;
channel_num = (unsigned)strtol(token, &tail_ptr, 10);
- if ((errno != 0) || (*tail_ptr != '\0') || tail_ptr == NULL)
+ if ((errno != 0) || tail_ptr == NULL || (*tail_ptr != '\0'))
break;
if (channel_num == CHANNEL_CMDS_MAX_VM_CHANNELS) {
@@ -408,7 +408,7 @@ cmd_channels_status_op_parsed(void *parsed_result, struct cmdline *cl,
break;
errno = 0;
channel_num = (unsigned)strtol(token, &tail_ptr, 10);
- if ((errno != 0) || (*tail_ptr != '\0') || tail_ptr == NULL)
+ if ((errno != 0) || tail_ptr == NULL || (*tail_ptr != '\0'))
break;
if (channel_num == CHANNEL_CMDS_MAX_VM_CHANNELS) {