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>
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",
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) {
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) {