summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-01-29 20:42:12 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-01-30 09:44:28 +0100
commit7dc5d9d1b43a653b6b840441802b7d56ece69755 (patch)
tree6e38f6c8d6ed85ed11a6f85e5e6fc0b201cf582a /commands
parente3ed8cf5885d52d7a3b9d6122acd891e492a6d49 (diff)
downloadbarebox-7dc5d9d1b43a653b6b840441802b7d56ece69755.tar.gz
barebox-7dc5d9d1b43a653b6b840441802b7d56ece69755.tar.xz
bbu: command: create temporary variable holding the pointer to the image
Create variable to hold the pointer to the image so that we can make the data.image pointer const later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/barebox-update.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/commands/barebox-update.c b/commands/barebox-update.c
index c2f2b68e08..84798ab0d9 100644
--- a/commands/barebox-update.c
+++ b/commands/barebox-update.c
@@ -28,6 +28,7 @@ static int do_barebox_update(int argc, char *argv[])
{
int opt, ret, repair = 0;
struct bbu_data data = {};
+ void *image = NULL;
while ((opt = getopt(argc, argv, "t:yf:ld:r")) > 0) {
switch (opt) {
@@ -59,9 +60,10 @@ static int do_barebox_update(int argc, char *argv[])
if (argc - optind > 0) {
data.imagefile = argv[optind];
- data.image = read_file(data.imagefile, &data.len);
- if (!data.image)
+ image = read_file(data.imagefile, &data.len);
+ if (!image)
return -errno;
+ data.image = image;
} else {
if (!repair)
return COMMAND_ERROR_USAGE;
@@ -69,7 +71,7 @@ static int do_barebox_update(int argc, char *argv[])
ret = barebox_update(&data);
- free(data.image);
+ free(image);
return ret;
}