]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/gmc-mh-1x-2x/api.c
config_get(): Don't check for sdi->priv != NULL.
[libsigrok.git] / src / hardware / gmc-mh-1x-2x / api.c
index 67ad40d34a5d1c6a531830810b7524b075c254eb..378b6263bf32c6cfd4b39e53c20bd22c4572d23b 100644 (file)
@@ -66,11 +66,6 @@ static const uint32_t devopts_bd[] = {
  * Need to implement device-specific lists.
  */
 
-static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
-{
-       return std_init(di, sr_ctx, LOG_PREFIX);
-}
-
 /**
  * Read single byte from serial port.
  *
@@ -377,9 +372,11 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
 
        (void)cg;
 
-       if (!sdi || !(devc = sdi->priv))
+       if (!sdi)
                return SR_ERR_ARG;
 
+       devc = sdi->priv;
+
        ret = SR_OK;
        switch (key) {
        case SR_CONF_LIMIT_SAMPLES:
@@ -518,7 +515,7 @@ SR_PRIV struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
        .name = "gmc-mh-1x-2x-rs232",
        .longname = "Gossen Metrawatt Metrahit 1x/2x, RS232 interface",
        .api_version = 1,
-       .init = init,
+       .init = std_init,
        .cleanup = std_cleanup,
        .scan = scan_1x_2x_rs232,
        .dev_list = std_dev_list,
@@ -537,7 +534,7 @@ SR_PRIV struct sr_dev_driver gmc_mh_2x_bd232_driver_info = {
        .name = "gmc-mh-2x-bd232",
        .longname = "Gossen Metrawatt Metrahit 2x, BD232/SI232-II interface",
        .api_version = 1,
-       .init = init,
+       .init = std_init,
        .cleanup = std_cleanup,
        .scan = scan_2x_bd232,
        .dev_list = std_dev_list,