X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fkecheng-kc-330b%2Fapi.c;h=7f49364a9dda516ddf61068f51f52128bca45ee9;hb=16aca7661b7ab34a399c323bb9214721e2b1be0c;hp=1e5480ac0581c35b3f47b33f54ccadb85f944717;hpb=aac29cc192ccf82b64e77b5e6b11b411da32deed;p=libsigrok.git diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index 1e5480ac..7f49364a 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -113,7 +113,6 @@ static GSList *scan(GSList *options) struct drv_context *drvc; struct dev_context *devc; struct sr_dev_inst *sdi; - struct sr_channel *ch; GSList *usb_devices, *devices, *l; char *model; @@ -136,14 +135,8 @@ static GSList *scan(GSList *options) sdi->driver = di; sdi->inst_type = SR_INST_USB; sdi->conn = l->data; - if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "SPL"))) - return NULL; - sdi->channels = g_slist_append(sdi->channels, ch); - - if (!(devc = g_try_malloc(sizeof(struct dev_context)))) { - sr_dbg("Device context malloc failed."); - return NULL; - } + sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL"); + devc = g_malloc0(sizeof(struct dev_context)); sdi->priv = devc; devc->limit_samples = 0; /* The protocol provides no way to read the current