 -	//for(i = 0; i < #_files; i++)
 -	for(i = 0; i < 1; i++)
 -	{
-+	ret = ext4fs_exists(file);
- 
+-
 -		ret = ext4fs_exists(file);
 -		if(!ret)
 -		{
 -			continue;
 -		}
--
++	ret = ext4fs_exists(file);
+ 
 -		printf("INFO: Found file to upgrade - %s\n", file);
 +	/*
 +	 * Upgrade file found, call the existing DFU utility
 +	 */
-+	if(ret)
++	if (ret)
 +	{
 +		debug("INFO: Found file to upgrade - %s\n", file);
  

 	alt_setting_num = dfu_get_alt(sb);
 	free(sb);
diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c
index da08881..f064da7 100644
--- a/drivers/mmc/gen_atmel_mci.c
+++ b/drivers/mmc/gen_atmel_mci.c
@@ -281,10 +281,7 @@ mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 				block_count++) {
 			word_count = 0;
 
-			if (block_count % 1000 == 0)
-			{
-				hw_watchdog_force();
-			}
+			WATCHDOG_RESET(1000);
 
 			do {
 				status = mci_data_op(mci, ioptr, error_flags);
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 424e870..fba004e 100644
--- a/drivers/mmc/mmc.c

+	ulong addr, part = 0;
 
-	int i, err, ret = 0;
+	int ret = 0;
 
 	/*
 	 * Load the SD card
 	 */
 	mmc = find_mmc_device(0);
-	if(!mmc)
+	if (!mmc)
 	{
-		printf("ERROR: Could not access SD card - %d\n", ret);
+		error("Could not access SD card\n");
+		return -1;
+
 	}
 
 	ret = mmc_init(mmc);
-	if(ret)
+	if (ret)
 	{
-		printf("ERROR: Could not init SD card - %d\n", ret);
+		error("Could not init SD card - %d\n", ret);
+		return -1;
 	}
 
 	/*
