]> sigrok.org Git - libsigrok.git/blobdiff - hardware/nexus-osciprime/api.c
serial-dmm: Drop unneeded g_try_malloc0().
[libsigrok.git] / hardware / nexus-osciprime / api.c
index c35e2cfb9b84c7c6b99a44daa24572d9207ff87e..bb3936b83b6d4a01f7a39890d6a5ce80ce88955c 100644 (file)
@@ -139,17 +139,7 @@ static int clear_instances(void)
 
 static int hw_init(struct sr_context *sr_ctx)
 {
-       struct drv_context *drvc;
-
-       if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
-               sr_err("Driver context malloc failed.");
-               return SR_ERR_MALLOC;
-       }
-
-       drvc->sr_ctx = sr_ctx;
-       di->priv = drvc;
-
-       return SR_OK;
+       return std_hw_init(sr_ctx, di, DRIVER_LOG_DOMAIN);
 }
 
 static GSList *hw_scan(GSList *options)
@@ -167,10 +157,7 @@ static GSList *hw_scan(GSList *options)
 
        (void)options;
 
-       if (!(drvc = di->priv)) {
-               sr_err("Driver was not initialized.");
-               return NULL;
-       }
+       drvc = di->priv;
 
        /* USB scan is always authoritative. */
        clear_instances();