if (in->module->init && in->module->init(in, new_opts) != SR_OK) {
g_free(in);
in = NULL;
+ } else {
+ in->buf = g_string_sized_new(128);
}
+
if (new_opts)
g_hash_table_destroy(new_opts);
- in->buf = g_string_sized_new(128);
return in;
}
-/* Returns TRUE is all required meta items are available. */
+/* Returns TRUE if all required meta items are available. */
static gboolean check_required_metadata(const uint8_t *metadata, uint8_t *avail)
{
int m, a;
/* Module didn't recognize this buffer. */
continue;
} else if (ret != SR_OK) {
- /* Can be SR_OK_CONTINUE. */
+ /* Can be SR_ERR_NA. */
return ret;
}
/* Module didn't recognize this buffer. */
continue;
} else if (ret != SR_OK) {
- /* Can be SR_OK_CONTINUE. */
+ /* Can be SR_ERR_NA. */
return ret;
}
* the device instance associated with this input instance, this is
* guaranteed to return the moment it's ready. This gives the caller
* the chance to examine the device instance, attach session callbacks
- * and on so.
+ * and so on.
*
* @since 0.4.0
*/
*
* @since 0.4.0
*/
-SR_API int sr_input_free(const struct sr_input *in)
+SR_API void sr_input_free(const struct sr_input *in)
{
- int ret;
-
if (!in)
- return SR_ERR_ARG;
+ return;
- ret = SR_OK;
if (in->module->cleanup)
- ret = in->module->cleanup((struct sr_input *)in);
+ in->module->cleanup((struct sr_input *)in);
if (in->sdi)
sr_dev_inst_free(in->sdi);
if (in->buf->len > 64) {
/* That seems more than just some sub-unitsize leftover... */
sr_warn("Found %d unprocessed bytes at free time.", in->buf->len);
}
- if (in->buf)
- g_string_free(in->buf, TRUE);
+ g_string_free(in->buf, TRUE);
g_free(in->priv);
g_free((gpointer)in);
-
- return ret;
}