From efca6310d6edca477d6430dbcb72f8ecc00f7b94 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 26 May 2018 20:50:50 +0300 Subject: configfs: Don't guess interface numbers if they can't be parsed Interface numbers are crucial parameters required for proper UVC gadget operation. If we can't parse them from ConfigFS there's little point in falling back to defaults that have a high chance being wrong. Treating that case as a fatal error is better to get the root cause fixed. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- configfs.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'configfs.c') diff --git a/configfs.c b/configfs.c index 4668e59..3b98f55 100644 --- a/configfs.c +++ b/configfs.c @@ -280,13 +280,7 @@ static int configfs_parse_interfaces(const char *fpath, ret = ret ? : attribute_read_uint(fpath, "streaming/bInterfaceNumber", &fc->streaming_interface); - if (ret) { - printf("Failed to obtain interface numbers, using defaults\n"); - fc->control_interface = 0; - fc->streaming_interface = 1; - } - - return 0; + return ret; } /* @@ -346,8 +340,8 @@ struct uvc_function_config *configfs_parse_uvc_function(const char *function) if (!fc->video) ret = -ENODEV; - /* Identify interface numbers, or fall back to defaults. */ - configfs_parse_interfaces(fpath, fc); + /* Identify interface numbers. */ + ret = ret ? : configfs_parse_interfaces(fpath, fc); ret = ret ? : attribute_read_uint(fpath, "streaming_interval", &fc->streaming_interval); -- cgit v1.2.3