re initializing `num_mics`: I'd add temporary variable here and only set `num_mics` on success, e.g.:

```c
U32 num_tmp = (U32) STATIC_ARRAY_SIZE (mics);

ret = MicInitAPI (&mic_handle, eTARGET_SCIF_DRIVER, mics, &num_tmp);
if (ret != MIC_ACCESS_API_SUCCESS) {
  ERROR("mic plugin: MicAccessAPI failed: %s", MicGetErrorString (ret));
  mic_handle = NULL;
  return (-1);
}

DEBUG ("mic plugin: Found %"PRIu32" MIC(s).", (uint32_t) num_tmp);
assert (((size_t) num_tmp) <= STATIC_ARRAY_SIZE (mics));
num_mics = num_tmp;
```