s5j/sss: fix sss_ro_read() return value
authorJunyeon LEE <junyeon2.lee@samsung.com>
Tue, 25 Apr 2017 21:09:27 +0000 (06:09 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Sat, 6 May 2017 13:46:10 +0000 (22:46 +0900)
This commit fixes the return value of sss_ro_read function.

Change-Id: I0a5c8b6476a35b9cca64597a7683db1f9362dc3a
Signed-off-by: Junyeon LEE <junyeon2.lee@samsung.com>
os/arch/arm/src/s5j/sss/sss_driver_io.c

index d73e8de..d53c12a 100644 (file)
@@ -17,7 +17,9 @@
  ****************************************************************************/
 
 #include <tinyara/config.h>
+
 #include <stdio.h>
+#include <errno.h>
 
 #include <tinyara/fs/fs.h>
 #include <tinyara/fs/mtd.h>
@@ -88,9 +90,10 @@ int sss_ro_read(unsigned int start_offset, unsigned char *buf, unsigned int byte
        if (ret < 0) {
                fdbg("Fail to read start_sector = %d, nsector = %d, errno = %d\n", start_sector, nsector, errno);
                ret = ERROR_SSTORAGE_SFS_FREAD;
-               goto read_out;
+       } else {
+               memcpy(buf, read_buf + (start_offset % geo.erasesize), byte_size);
+               ret = 0;
        }
-       memcpy(buf, read_buf + (start_offset % geo.erasesize), byte_size);
 
 read_out:
        if (close_blockdriver(pnode)) {