This is an automated email from Gerrit.

Ivo Manca ([email protected]) just uploaded a new patch set to Gerrit, which you 
can find at http://openocd.zylin.com/3507

-- gerrit

commit 3a6a83859822fc8d64e7a85be19b028f87130e66
Author: Ivo Manca <[email protected]>
Date:   Mon May 23 13:19:29 2016 +0200

    nand: fix return value (part 2)
    
    Various nand commands either returned ERROR_OK or
    ERROR_COMMAND_SYNTAX_ERROR when the device was not yet probed.
    Unified this to ERROR_NAND_DEVICE_NOT_PROBED.
    This also fixes a floating point exception when calling
    'nand check_bad_blocks' before probing a device.
    
    Change-Id: I842deb9bf273e602c2233f092eb8c095b45f4234
    Signed-off-by: Ivo Manca <[email protected]>

diff --git a/src/flash/nand/tcl.c b/src/flash/nand/tcl.c
index 5db29ab..c7b0298 100644
--- a/src/flash/nand/tcl.c
+++ b/src/flash/nand/tcl.c
@@ -90,7 +90,7 @@ COMMAND_HANDLER(handle_nand_info_command)
 
        if (NULL == p->device) {
                command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
-               return ERROR_OK;
+               return ERROR_NAND_DEVICE_NOT_PROBED;
        }
 
        if (first >= p->num_blocks)
@@ -166,6 +166,11 @@ COMMAND_HANDLER(handle_nand_erase_command)
        if (ERROR_OK != retval)
                return retval;
 
+       if (NULL == p->device) {
+               command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
+               return ERROR_NAND_DEVICE_NOT_PROBED;
+       }
+
        unsigned long offset;
        unsigned long length;
 
@@ -213,6 +218,11 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
        if (ERROR_OK != retval)
                return retval;
 
+       if (NULL == p->device) {
+               command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
+               return ERROR_NAND_DEVICE_NOT_PROBED;
+       }
+
        if (CMD_ARGC == 3) {
                unsigned long offset;
                unsigned long length;
@@ -393,7 +403,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command)
 
        if (NULL == p->device) {
                command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
-               return ERROR_OK;
+               return ERROR_NAND_DEVICE_NOT_PROBED;
        }
 
        if (CMD_ARGC == 2)

-- 

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to