[Skiboot] [PATCH 11/17] external/pflash: Update the code pathes for "--tune"

Cyril Bur cyril.bur at au1.ibm.com
Fri Jul 21 16:36:02 AEST 2017


It doesn't make sense for --tune to do anything unless --direct was
passed.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 external/pflash/pflash.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index a797af62..f280f4c0 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -590,6 +590,7 @@ static void print_help(const char *pname)
 	printf("\t\ttake place first.\n\n");
 	printf("\t-t, --tune\n");
 	printf("\t\tJust tune the flash controller & access size\n");
+	printf("\t\tMust be used in conjuction with --direct\n");
 	printf("\t\t(Implicit for all other operations)\n\n");
 	printf("\t-c --clear\n");
 	printf("\t\tUsed to ECC clear a partition of the flash\n");
@@ -894,7 +895,17 @@ int main(int argc, char *argv[])
 		write_size = stbuf.st_size;
 	}
 
+	if (tune && !direct) {
+		fprintf(stderr, "It doesn't make sense to --tune with --direct\n");
+		rc = 1;
+		goto out;
+	}
+
 	if (direct) {
+		/* If -t is passed, then print a nice message */
+		if (tune)
+			printf("Flash and controller tuned\n");
+
 		if (arch_flash_access(NULL, bmc_flash ? BMC_DIRECT : PNOR_DIRECT) == ACCESS_INVAL) {
 			fprintf(stderr, "Can't access %s flash directly on this architecture\n",
 			        bmc_flash ? "BMC" : "PNOR");
@@ -924,9 +935,6 @@ int main(int argc, char *argv[])
 		goto out;
 	}
 
-	/* If -t is passed, then print a nice message */
-	if (tune)
-		printf("Flash and controller tuned\n");
 
 	/* If read specified and no read_size, use flash size */
 	if (do_read && !read_size && !part_name)
-- 
2.13.3



More information about the Skiboot mailing list