Fix [ 1851777 ] segfault when running "detectflash"

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@855 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Kolja Waschk 17 years ago
parent fd1757343b
commit 540b4be57d

@ -1,5 +1,7 @@
2007-12-16 Kolja Waschk <kawk>
* libbrux/amd/amd_flash.c: Fix for [1851777] segfault when
running detectflash
* include/setdevice.h, include/Makefile.am, src/detect.c,
src/cmd/setdevice.c, src/cmd/cmd.c, src/cmd/Makefile.am,
src/jtag.c, doc/UrJTAG.txt, libbrux/flash/amd_flash.c,

@ -90,6 +90,13 @@ int amd_detect(bus_t *bus, uint32_t adr, cfi_array_t **cfi_array )
bus_area_t area;
cfi_query_structure_t *cfi ;
if (!cfi_array || !bus)
return -1; /* invalid parameters */
*cfi_array = calloc( 1, sizeof (cfi_array_t) );
if (!*cfi_array)
return -2; /* out of memory */
bus_write( bus, adr+0x0, 0xf0 );
bus_write( bus, adr+0x555, 0xaa );
bus_write( bus, adr+0x2AA, 0x55 );
@ -115,10 +122,6 @@ int amd_detect(bus_t *bus, uint32_t adr, cfi_array_t **cfi_array )
break;
}
*cfi_array = calloc( 1, sizeof (cfi_array_t) );
if (!*cfi_array)
return -2; /* out of memory */
(*cfi_array)->bus = bus;
(*cfi_array)->address = 0;
if (bus_area( bus, adr+0, &area ) != 0)

Loading…
Cancel
Save