From ffc20c8df7bbb4f729b2dc8b660225572bebf16f Mon Sep 17 00:00:00 2001
From: Joerg Wunsch <j@uriah.heep.sax.de>
Date: Wed, 6 Sep 2006 22:33:59 +0000
Subject: [PATCH] In stk500v2_jtagmkII_open(), when the ICE synchronization
 failed, still call the close method so we sign off correctly from the ICE:

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@646 81a1dc3b-b13d-400b-aceb-764788c761c2
---
 stk500v2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/stk500v2.c b/stk500v2.c
index e4e624f9..f74efa71 100644
--- a/stk500v2.c
+++ b/stk500v2.c
@@ -2140,6 +2140,7 @@ static int stk500v2_jtagmkII_open(PROGRAMMER * pgm, char * port)
   if (jtagmkII_getsync(pgm, EMULATOR_MODE_SPI) != 0) {
     fprintf(stderr, "%s: failed to sync with the JTAG ICE mkII in ISP mode\n",
             progname);
+    pgm->close(pgm);		/* sign off correctly */
     exit(1);
   }