diff mbox series

[BlueZ] main: fixing logical error when loading controller params

Message ID 20200618014812.234606-1-alainm@chromium.org
State New
Headers show
Series [BlueZ] main: fixing logical error when loading controller params | expand

Commit Message

Alain Michaud June 18, 2020, 1:48 a.m. UTC
Fixing logical error when loading configuration parameters from the
config file.  Without this patch, the maximum allowable value is always
used.

---

 src/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/main.c b/src/main.c
index e51f614b3..75ea27f40 100644
--- a/src/main.c
+++ b/src/main.c
@@ -421,12 +421,13 @@  static void parse_controller_config(GKeyFile *config)
 		int val = g_key_file_get_integer(config, "Controller",
 						params[i].val_name, &err);
 		if (err) {
+			warn("%s", err->message);
 			g_clear_error(&err);
 		} else {
-			DBG("%s=%d", params[i].val_name, val);
+			info("%s=%d", params[i].val_name, val);
 
-			val = MIN(val, params[i].min);
-			val = MAX(val, params[i].max);
+			val = MAX(val, params[i].min);
+			val = MIN(val, params[i].max);
 			*params[i].val = val;
 			++main_opts.default_params.num_entries;
 		}