From: Bert Vermeulen Date: Sun, 7 Apr 2013 19:50:42 +0000 (+0200) Subject: return SR_ERR_ARG if a driver doesn't implement sr_config_*() X-Git-Tag: dsupstream~180 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6cefe516aacc215fa8d144e9da09e69cfb1e5ff6;p=libsigrok.git return SR_ERR_ARG if a driver doesn't implement sr_config_*() --- diff --git a/hwdriver.c b/hwdriver.c index 25d92b68..d48131d2 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -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);