X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=hardware%2Fhantek-dso%2Fapi.c;h=97742ffe88a4a8bb225a2449e016162bbbcd9b4c;hb=7c8a9e1e0fada5d726bce638cf4d36147ed4ebbf;hp=7c2eaa954f00471e223dfac021be341f22468d90;hpb=6a4710fac267c07cc146b2a3cd23204b08bea552;p=libsigrok.git diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 7c2eaa95..97742ffe 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -259,17 +259,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) @@ -285,11 +275,12 @@ static GSList *hw_scan(GSList *options) (void)options; - devcnt = 0; - devices = 0; drvc = di->priv; drvc->instances = NULL; + devcnt = 0; + devices = 0; + clear_instances(); /* Find all Hantek DSO devices and upload firmware to all of them. */