]> sigrok.org Git - libsigrok.git/commitdiff
return SR_ERR_ARG if a driver doesn't implement sr_config_*()
authorBert Vermeulen <redacted>
Sun, 7 Apr 2013 19:50:42 +0000 (21:50 +0200)
committerBert Vermeulen <redacted>
Thu, 11 Apr 2013 16:32:08 +0000 (18:32 +0200)
hwdriver.c

index 25d92b68a9d7b95543820e7624750e7e663ab120..d48131d26b4069d9577998dc0819676915f484ce 100644 (file)
@@ -410,6 +410,9 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver, int key,
        if (!driver || !data)
                return SR_ERR;
 
+       if (!driver->config_get)
+               return SR_ERR_ARG;
+
        if ((ret = driver->config_get(key, data, sdi)) == SR_OK) {
                /* Got a floating reference from the driver. Sink it here,
                 * caller will need to unref when done with it. */
@@ -474,8 +477,10 @@ SR_API int sr_config_list(const struct sr_dev_driver *driver, int key,
 {
        int ret;
 
-       if (!driver || !data || !driver->config_list)
+       if (!driver || !data)
                ret = SR_ERR;
+       else if (!sdi->driver->config_list)
+               ret = SR_ERR_ARG;
        else if ((ret = driver->config_list(key, data, sdi)) == SR_OK)
                g_variant_ref_sink(*data);