From 8a33c993a5771b041b67c365378ac40f76365da7 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 1 Mar 2011 16:14:36 +0100 Subject: Write LSB first and fix memory allocation bug --- cli.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cli.c') diff --git a/cli.c b/cli.c index daed679..adf0f4b 100644 --- a/cli.c +++ b/cli.c @@ -376,8 +376,11 @@ int WriteData(int handle, int bar, unsigned long addr, int n, int access, char * int size = n * abs(access); err = posix_memalign( (void**)&buf, 256, size ); - if (!err) err = posix_memalign( (void**)&check, 256, size ); - if ((!err)||(!buf)||(!check)) Error("Allocation of %i bytes of memory have failed", size); + if (!err) { + err = posix_memalign( (void**)&check, 256, size ); + } + if ((err)||(!buf)||(!check)) + Error("Allocation of %i bytes of memory have failed", size); for (i = 0; i < n; i++) { switch (access) { -- cgit v1.2.3