flash/at91sam4: fix clang static analyzer warning 39/4639/3
authorTomas Vanek <vanekt@fbl.cz>
Sun, 5 Aug 2018 14:39:31 +0000 (16:39 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Tue, 21 Aug 2018 18:26:14 +0000 (19:26 +0100)
Change-Id: I5e5319d855c868adfa012f68086f7f809ec5a069
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4639
Tested-by: jenkins
src/flash/nor/at91sam4.c

index 577360a..2eec15e 100644 (file)
@@ -3131,7 +3131,8 @@ showall:
                }
                if ((who >= 0) && (((unsigned)(who)) < pChip->details.n_gpnvms)) {
                        r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), who, &v);
-                       command_print(CMD_CTX, "sam4-gpnvm%u: %u", who, v);
+                       if (r == ERROR_OK)
+                               command_print(CMD_CTX, "sam4-gpnvm%u: %u", who, v);
                        return r;
                } else {
                        command_print(CMD_CTX, "sam4-gpnvm invalid GPNVM: %u", who);