X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fgmc-mh-1x-2x%2Fapi.c;h=02eb6d6e18e7bcb21778f9879336e71ea42bc00e;hb=f57d8ffe66612a1fdc20ed09c222f8ea59bd84d4;hp=32a471afe4e3cdf10a2acce95ab77ec45b41678f;hpb=aac29cc192ccf82b64e77b5e6b11b411da32deed;p=libsigrok.git diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c index 32a471af..02eb6d6e 100644 --- a/src/hardware/gmc-mh-1x-2x/api.c +++ b/src/hardware/gmc-mh-1x-2x/api.c @@ -227,17 +227,13 @@ static GSList *scan_1x_2x_rs232(GSList *options) sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(VENDOR_GMC); sdi->model = g_strdup(gmc_model_str(model)); - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_err("Device context malloc failed."); - return NULL; - } + devc = g_malloc0(sizeof(struct dev_context)); devc->model = model; devc->limit_samples = 0; devc->limit_msec = 0; devc->num_samples = 0; devc->elapsed_msec = g_timer_new(); devc->settings_ok = FALSE; - sdi->conn = serial; sdi->priv = devc; sdi->driver = &gmc_mh_1x_2x_rs232_driver_info; @@ -299,10 +295,7 @@ static GSList *scan_2x_bd232(GSList *options) if (serial_open(serial, SERIAL_RDWR) != SR_OK) goto exit_err; - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_err("Device context malloc failed."); - goto exit_err; - } + devc = g_malloc0(sizeof(struct dev_context)); sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; @@ -350,10 +343,7 @@ static GSList *scan_2x_bd232(GSList *options) drvc->instances = g_slist_append(drvc->instances, sdi); devices = g_slist_append(devices, sdi); - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_err("Device context malloc failed."); - goto exit_err; - } + devc = g_malloc0(sizeof(struct dev_context)); sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE;