summaryrefslogtreecommitdiff
path: root/iscsiuio/src/unix/nic_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'iscsiuio/src/unix/nic_utils.c')
-rw-r--r--iscsiuio/src/unix/nic_utils.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/iscsiuio/src/unix/nic_utils.c b/iscsiuio/src/unix/nic_utils.c
index cc11f9a..d57cc4f 100644
--- a/iscsiuio/src/unix/nic_utils.c
+++ b/iscsiuio/src/unix/nic_utils.c
@@ -973,9 +973,9 @@ int nic_enable(nic_t *nic)
/**
* nic_disable() - Function used to disable the NIC
* @param nic - NIC to disble
- * @return 0 on success, <0 on failure
+ * @return void
*/
-int nic_disable(nic_t *nic, int going_down)
+void nic_disable(nic_t *nic, int going_down)
{
if (nic->state == NIC_STARTED_RUNNING ||
nic->state == NIC_RUNNING) {
@@ -996,6 +996,12 @@ int nic_disable(nic_t *nic, int going_down)
/* Convert from timeval to timespec */
rc = gettimeofday(&tp, NULL);
+ if (rc) {
+ LOG_ERR("gettimeofday failed, should never happen: %d\n", errno);
+ pthread_mutex_unlock(&nic->nic_mutex);
+ return;
+ }
+
ts.tv_sec = tp.tv_sec;
ts.tv_nsec = tp.tv_usec * 1000;
ts.tv_sec += 5; /* TODO: hardcoded wait for 5 seconds */
@@ -1003,16 +1009,18 @@ int nic_disable(nic_t *nic, int going_down)
/* Wait for the device to be disabled */
rc = pthread_cond_timedwait(&nic->disable_wait_cond,
&nic->nic_mutex, &ts);
+ if (rc) {
+ LOG_ERR("cond_timedwait failed, should never happen: %d\n", errno);
+ }
+
pthread_mutex_unlock(&nic->nic_mutex);
LOG_DEBUG(PFX "%s: device disabled", nic->log_name);
- return 0;
} else {
LOG_WARN(PFX "%s: device already disabled: "
"flag: 0x%x state: 0x%x",
nic->log_name, nic->flags, nic->state);
- return -EALREADY;
}
}