]> sigrok.org Git - libsigrok.git/commitdiff
Consistently don't check sdi->priv in dev_acquisition_start().
authorUwe Hermann <redacted>
Sun, 27 Mar 2016 21:16:59 +0000 (23:16 +0200)
committerUwe Hermann <redacted>
Fri, 29 Apr 2016 16:08:15 +0000 (18:08 +0200)
Most drivers already assume this to be != NULL anyway, and the check
should probably be in the API wrappers anyway.

26 files changed:
src/hardware/agilent-dmm/api.c
src/hardware/appa-55ii/api.c
src/hardware/arachnid-labs-re-load-pro/api.c
src/hardware/atten-pps3xxx/api.c
src/hardware/beaglelogic/api.c
src/hardware/brymen-bm86x/api.c
src/hardware/brymen-dmm/api.c
src/hardware/cem-dt-885x/api.c
src/hardware/chronovu-la/api.c
src/hardware/colead-slm/api.c
src/hardware/fluke-dmm/api.c
src/hardware/gmc-mh-1x-2x/api.c
src/hardware/hung-chang-dso-2100/api.c
src/hardware/ikalogic-scanaplus/api.c
src/hardware/kecheng-kc-330b/api.c
src/hardware/kern-scale/api.c
src/hardware/maynuo-m97/api.c
src/hardware/norma-dmm/api.c
src/hardware/openbench-logic-sniffer/api.c
src/hardware/pipistrello-ols/api.c
src/hardware/serial-dmm/api.c
src/hardware/teleinfo/api.c
src/hardware/tondaj-sl-814/api.c
src/hardware/uni-t-dmm/api.c
src/hardware/uni-t-ut32x/api.c
src/hardware/zeroplus-logic-cube/api.c

index 594b1b7322cc4029d0e994b532fd8dba6d99563a..dd39322cf3f5b6a2e65b030abcd46482d15fde45 100644 (file)
@@ -235,11 +235,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
-
+       devc = sdi->priv;
        devc->cb_data = cb_data;
 
        std_session_send_df_header(cb_data, LOG_PREFIX);
index 86f78543cd686b47a2ed54991fead49a70053aa4..e033f5d37d8f3216f8f1c9e5732007e80d038bda 100644 (file)
@@ -225,8 +225,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct sr_serial_dev_inst *serial;
        struct dev_context *devc;
@@ -235,11 +234,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
-
+       devc = sdi->priv;
        devc->session_cb_data = cb_data;
 
        /*
index 86d34a47fa7f9ea2bfa539d89b33d23b5e4cc08c..1c351ffe675fb91fa8d621e32d1bb7c6c168dd59 100644 (file)
@@ -352,7 +352,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                return SR_ERR_DEV_CLOSED;
 
        devc = sdi->priv;
-
        serial = sdi->conn;
 
        /* Send the 'monitor <ms>' command (doesn't have a reply). */
index efe06acc4046e4536035bef1669dbd9267462201..c90ab12d9cdd78878d3059ddf2d51d835b1eb526 100644 (file)
@@ -460,8 +460,7 @@ static int dev_close(struct sr_dev_inst *sdi)
        return std_serial_dev_close(sdi);
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
index 6e88188918eb34af70c8f374c25d5b13dec7db0a..eb0d186a90f55a7f0fcc2e9fdd5a4cea1becbaae 100644 (file)
@@ -337,13 +337,13 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
 #define BUFUNIT_TIMEOUT_MS(devc)       (100 + ((devc->bufunitsize * 1000) / \
                                (uint32_t)(devc->cur_samplerate)))
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-                                   void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
-       (void)cb_data;
        struct dev_context *devc = sdi->priv;
        struct sr_trigger *trigger;
 
+       (void)cb_data;
+
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
index 71de86d1e6750b2824dd5b8d585f1b60a67edb6d..4098b9269b88d3ceb74ef990a129b6902d07102c 100644 (file)
@@ -249,8 +249,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-                                   void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc;
 
index c0ee0b47fc6238ceeca2ff45b31d722f656a321d..3700515f2da1242f410e1aa2714e186e28b29a46 100644 (file)
@@ -202,11 +202,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
-
+       devc = sdi->priv;
        devc->cb_data = cb_data;
 
        /*
index ff2edb1292c07e2e862f0b2b5f5e29c29e4fb754..b9a7cb684ebfed683f7526a8c6cea336f839a4f3 100644 (file)
@@ -386,11 +386,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
-
+       devc = sdi->priv;
        devc->cb_data = cb_data;
        devc->state = ST_INIT;
        devc->num_samples = 0;
index 4ea1440af6f18f0d7cc93afc66fde35b395c69ed..5914ef21d4ca3faf812d01bf47b3f78d1f464a76 100644 (file)
@@ -515,10 +515,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
+       devc = sdi->priv;
 
        if (!devc->ftdic) {
                sr_err("devc->ftdic was NULL.");
index 2841304a485821a47ab0dbe740c4af216867b25f..b75af7f6d2b8043c9f1f19d4dde441bcfe0399c8 100644 (file)
@@ -179,11 +179,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
-
+       devc = sdi->priv;
        devc->cb_data = cb_data;
 
        std_session_send_df_header(cb_data, LOG_PREFIX);
index 599f1115ef8f6345de5fd16107651496daeb9558..a7b2e14d0d103dbfb25479a6cd9d475e0405d795 100644 (file)
@@ -259,11 +259,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
-
+       devc = sdi->priv;
        devc->cb_data = cb_data;
 
        std_session_send_df_header(cb_data, LOG_PREFIX);
index 639cce03aca1d2671e2b22e1a2700dda2c70af22..d4e44b2512b93da5c72e5b240abc2dfc5b8cc224 100644 (file)
@@ -466,12 +466,10 @@ static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi,
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (!sdi || !cb_data || !(devc = sdi->priv))
-               return SR_ERR_BUG;
-
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
+       devc = sdi->priv;
        devc->cb_data = cb_data;
        devc->settings_ok = FALSE;
        devc->buflen = 0;
@@ -496,12 +494,10 @@ static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi,
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (!sdi || !cb_data || !(devc = sdi->priv))
-               return SR_ERR_BUG;
-
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
+       devc = sdi->priv;
        devc->cb_data = cb_data;
        devc->settings_ok = FALSE;
        devc->buflen = 0;
index e76b9a517d8daa2e40391bb7f5f07387a5df34e1..9f2d56a063eb810e0c8a0e041836fca9e79b1c70 100644 (file)
@@ -686,8 +686,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc = sdi->priv;
        int ret;
index dd457c8045ceef62191a10059896593008bb0512..c445b99353b4ee77bc90bb8acf27229af9e768b9 100644 (file)
@@ -358,8 +358,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv))
-               return SR_ERR_BUG;
+       devc = sdi->priv;
 
        if (!devc->ftdic)
                return SR_ERR_BUG;
index e299a339b1efc5c445436d82e40f8a32b2dfb401..df11489d46e4ca744b82fd9e08bfc465b6ea6729 100644 (file)
@@ -413,8 +413,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct sr_dev_driver *di = sdi->driver;
        struct drv_context *drvc;
index 6801abfe6107c51c957a8fbb66710c1fbe2d66fb..b5e5c28095092b8d6addafe109aad3cea3bb4390 100644 (file)
@@ -191,11 +191,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv))
-               return SR_ERR_BUG;
-
+       devc = sdi->priv;
        devc->cb_data = cb_data;
-
        serial = sdi->conn;
 
        sr_spew("Set O1 mode (continuous values, stable and unstable ones).");
index 46b3e0eab4ed9ad25cc6646a6458476b74412553..4b92446e93ea37ef0ecc03e09f8303e0905cf331 100644 (file)
@@ -453,8 +453,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        return ret;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc;
        struct sr_modbus_dev_inst *modbus;
index 59715ec421d0b4e9c9d35b81ae0d4b803255c70f..3e6eab7805c100c807b4302add1a41f438341105 100644 (file)
@@ -254,12 +254,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (!sdi || !cb_data || !(devc = sdi->priv))
-               return SR_ERR_BUG;
-
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
+       devc = sdi->priv;
        devc->cb_data = cb_data;
 
        std_session_send_df_header(cb_data, LOG_PREFIX);
index d4cd1c2d479f7273d08cf5191387b8cb99db2535..af1ce7842f475522102664bd7abf6ba41a6ec20f 100644 (file)
@@ -463,8 +463,7 @@ static int set_trigger(const struct sr_dev_inst *sdi, int stage)
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
index d015d7d572d25d1b7e0e7c9a49f72a680e30334c..865c3bf6bef9219daa57ca68d7204bb198c5e7f7 100644 (file)
@@ -535,8 +535,7 @@ static int disable_trigger(const struct sr_dev_inst *sdi, int stage)
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc;
        uint32_t samplecount, readcount, delaycount;
index 03af2d580a9f3af22b259da5c76ef258ab7aee72..f53381bf93856f3b2d1ae935ec8d8a5deca49f4a 100644 (file)
@@ -219,11 +219,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
-
+       devc = sdi->priv;
        devc->cb_data = cb_data;
 
        /*
index 667ce33dfbd5f8eb545d25b8b3ad0d34b01fe710..1becb31e2542781bc5f0a3194b005c71ee921395 100644 (file)
@@ -202,11 +202,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
-
+       devc = sdi->priv;
        devc->session_cb_data = cb_data;
 
        /*
index 07a8ecae283cdbf97456e9da03a388dc4586f978..979a8bea030d9b08e4af315b792384a468b6fd12 100644 (file)
@@ -161,8 +161,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-                                   void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
index ffafcd085efa6eb1c3176a4a99b4b0198a77713e..f3416c265359b3306992ba30e4e4689518221315 100644 (file)
@@ -194,9 +194,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        struct dev_context *devc;
 
        devc = sdi->priv;
-
        devc->cb_data = cb_data;
-
        devc->starttime = g_get_monotonic_time();
 
        std_session_send_df_header(sdi, LOG_PREFIX);
index 2c63c279ee451f57546006f8c68e5c51bf8c3f43..ea57ed033def29ccc15eb2d37fed0017204926d2 100644 (file)
@@ -271,8 +271,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-                                   void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct sr_dev_driver *di = sdi->driver;
        struct drv_context *drvc;
index ab4c3cc4eb99525f4d9155895fe6e9beb9cd9d20..ca3d5ad2f8403c231c3a1b4c76c1702bc80488f5 100644 (file)
@@ -512,8 +512,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc;
        struct sr_usb_dev_inst *usb;
@@ -538,10 +537,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("%s: sdi->priv was NULL", __func__);
-               return SR_ERR_ARG;
-       }
+       devc = sdi->priv;
 
        if (analyzer_add_triggers(sdi) != SR_OK) {
                sr_err("Failed to configure triggers.");