aboutsummaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-07-28 16:46:31 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-01 13:57:47 +1000
commitf988ee566c1ea21fb23515deb8b0e1c238b17594 (patch)
treeced63271de2de252bcd0a24239af57d8b2a3ba6d /external
parentb9454866da48a68305b639c142d649b9cb9cf005 (diff)
downloadskiboot-f988ee566c1ea21fb23515deb8b0e1c238b17594.zip
skiboot-f988ee566c1ea21fb23515deb8b0e1c238b17594.tar.gz
skiboot-f988ee566c1ea21fb23515deb8b0e1c238b17594.tar.bz2
external/pflash: Move write and read size calculation together
Very simple rework, makes sense to calculate those at the same time. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/pflash/pflash.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index c0d9686..e917a2a 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -884,19 +884,6 @@ int main(int argc, char *argv[])
goto out;
}
- /* If file specified but not size, get size from file
- */
- if (write_file && !write_size) {
- struct stat stbuf;
-
- if (stat(write_file, &stbuf)) {
- perror("Failed to get file size");
- rc = 1;
- goto out;
- }
- write_size = stbuf.st_size;
- }
-
if (tune && !direct) {
fprintf(stderr, "It doesn't make sense to --tune without --direct\n");
rc = 1;
@@ -937,6 +924,17 @@ int main(int argc, char *argv[])
goto out;
}
+ /* If file specified but not size, get size from file */
+ if (write_file && !write_size) {
+ struct stat stbuf;
+
+ if (stat(write_file, &stbuf)) {
+ perror("Failed to get file size");
+ rc = 1;
+ goto out;
+ }
+ write_size = stbuf.st_size;
+ }
/* If read specified and no read_size, use flash size */
if (do_read && !read_size && !part_name)