From 8f6dff00ec3b01a2a541558b648b603b0ebc90ff Mon Sep 17 00:00:00 2001 From: Alex Williams Date: Wed, 5 Sep 2018 10:11:55 -0700 Subject: tools: Fix handling of 0-valued dt-compat A value of 0 for dt-compat would cause db-init to use the rev instead. This fixes the check to be on number of args instead of the dt-compat value. --- mpm/tools/db-init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mpm/tools/db-init.c b/mpm/tools/db-init.c index 20f71915e..30b559c8a 100644 --- a/mpm/tools/db-init.c +++ b/mpm/tools/db-init.c @@ -42,11 +42,13 @@ int main(int argc, char *argv[]) if (argc >= 6) dt_compat = atoi(argv[5]); + else + dt_compat = get_dt_compat(atoi(argv[3])); which_slot = atoi(argv[1]); ep = usrp_sulfur_db_eeprom_new(strtol(argv[2], NULL, 16), atoi(argv[3]), argv[4], - dt_compat ? dt_compat : get_dt_compat(atoi(argv[3]))); + dt_compat); usrp_sulfur_db_eeprom_print(ep); if (!which_slot) -- cgit v1.2.3