kontron_wdt: Adjusting exit path
authorErwan Velu <erwan.velu@zodiacaerospace.com>
Mon, 10 Sep 2012 15:35:13 +0000 (17:35 +0200)
committerErwan Velu <erwanaliasr1@gmail.com>
Mon, 10 Sep 2012 18:20:25 +0000 (20:20 +0200)
If we fail, at least let's boot the expected image

com32/modules/kontron_wdt.c

index 46d37d0..6d21d7c 100644 (file)
@@ -380,28 +380,31 @@ int main(int argc, const char *argv[]) {
         if (status & KEMPLD_WDT_CFG_ENABLE) {
                 kempld_wdt_keepalive(&wdt);
         } else {
-                ret = kempld_wdt_settimeout(&wdt);
+               ret = kempld_wdt_settimeout(&wdt);
                 if (ret) {
                        printf("Unable to setup timeout !\n");
-                       kempld_release_mutex(&pld);
-                       return -1;
+                       goto booting;
                }
-                ret = kempld_wdt_start(&wdt);
+
+               ret = kempld_wdt_start(&wdt);
                 if (ret) {
                        printf("Unable to start watchdog !\n");
-                       kempld_release_mutex(&pld);
-                       return -1;
+                       goto booting;
                }
 
         }
 
+       printf("Watchog armed ! Rebooting in %d seconds if no feed occurs !\n",wdt.timeout);
+
+booting:
        /* Release Mutex to let Linux's Driver taking control */
         kempld_release_mutex(&pld);
-       printf("Watchog armed ! Rebooting in %d seconds if no feed occurs !\n",wdt.timeout);
 
        /* Let's boot the default entry if specified */
        if (strlen(default_label)>0) {
                printf("Executing default label = '%s'\n",default_label);
                syslinux_run_command(default_label);
+       } else {
+               return ret;
        }
 }