]> git.sur5r.net Git - openocd/commitdiff
Zach Welch <zw@superlucidity.net> fix str9x type-punned pointer
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 21 Apr 2009 05:36:53 +0000 (05:36 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 21 Apr 2009 05:36:53 +0000 (05:36 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1484 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/flash/str9x.c

index 45a3fd67789236c9f97f5d424e8d9a916299f931..fbba4fec4b748dcafe5551cb734637fa20d52202 100644 (file)
@@ -194,6 +194,7 @@ static int str9x_protect_check(struct flash_bank_s *bank)
        int i;
        u32 adr;
        u32 status = 0;
+       u16 hstatus = 0;
 
        if (bank->target->state != TARGET_HALTED)
        {
@@ -212,10 +213,11 @@ static int str9x_protect_check(struct flash_bank_s *bank)
                        {
                                return retval;
                        }
-                       if ((retval=target_read_u16(target, adr, (u16*)&status))!=ERROR_OK)
+                       if ((retval=target_read_u16(target, adr, &hstatus))!=ERROR_OK)
                        {
                                return retval;
                        }
+                       status = hstatus;
                }
                else
                {
@@ -237,10 +239,11 @@ static int str9x_protect_check(struct flash_bank_s *bank)
                {
                        return retval;
                }
-               if ((retval=target_read_u16(target, adr, (u16*)&status))!=ERROR_OK)
+               if ((retval=target_read_u16(target, adr, &hstatus))!=ERROR_OK)
                {
                        return retval;
                }
+               status = hstatus;
        }
        
        /* read array command */