mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-21 20:34:38 +00:00
tools: kwbimage: Reduce scope of variables
This patch reduces the scope of some variables. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
885fba155c
commit
e89016c44b
1 changed files with 5 additions and 4 deletions
|
@ -230,7 +230,6 @@ static void *image_create_v0(size_t *imagesz, struct image_tool_params *params,
|
||||||
struct image_cfg_element *e;
|
struct image_cfg_element *e;
|
||||||
size_t headersz;
|
size_t headersz;
|
||||||
struct main_hdr_v0 *main_hdr;
|
struct main_hdr_v0 *main_hdr;
|
||||||
struct ext_hdr_v0 *ext_hdr;
|
|
||||||
uint8_t *image;
|
uint8_t *image;
|
||||||
int has_ext = 0;
|
int has_ext = 0;
|
||||||
|
|
||||||
|
@ -282,6 +281,7 @@ static void *image_create_v0(size_t *imagesz, struct image_tool_params *params,
|
||||||
|
|
||||||
/* Generate the ext header */
|
/* Generate the ext header */
|
||||||
if (has_ext) {
|
if (has_ext) {
|
||||||
|
struct ext_hdr_v0 *ext_hdr;
|
||||||
int cfgi, datai;
|
int cfgi, datai;
|
||||||
|
|
||||||
ext_hdr = (struct ext_hdr_v0 *)
|
ext_hdr = (struct ext_hdr_v0 *)
|
||||||
|
@ -313,7 +313,6 @@ static size_t image_headersz_v1(struct image_tool_params *params,
|
||||||
{
|
{
|
||||||
struct image_cfg_element *binarye;
|
struct image_cfg_element *binarye;
|
||||||
size_t headersz;
|
size_t headersz;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculate the size of the header and the size of the
|
* Calculate the size of the header and the size of the
|
||||||
|
@ -333,6 +332,7 @@ static size_t image_headersz_v1(struct image_tool_params *params,
|
||||||
|
|
||||||
binarye = image_find_option(IMAGE_CFG_BINARY);
|
binarye = image_find_option(IMAGE_CFG_BINARY);
|
||||||
if (binarye) {
|
if (binarye) {
|
||||||
|
int ret;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
||||||
ret = stat(binarye->binary.file, &s);
|
ret = stat(binarye->binary.file, &s);
|
||||||
|
@ -388,7 +388,6 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
|
||||||
size_t headersz;
|
size_t headersz;
|
||||||
uint8_t *image, *cur;
|
uint8_t *image, *cur;
|
||||||
int hasext = 0;
|
int hasext = 0;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculate the size of the header and the size of the
|
* Calculate the size of the header and the size of the
|
||||||
|
@ -444,6 +443,7 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
|
||||||
struct stat s;
|
struct stat s;
|
||||||
int argi;
|
int argi;
|
||||||
FILE *bin;
|
FILE *bin;
|
||||||
|
int ret;
|
||||||
|
|
||||||
hdr->headertype = OPT_HDR_V1_BINARY_TYPE;
|
hdr->headertype = OPT_HDR_V1_BINARY_TYPE;
|
||||||
|
|
||||||
|
@ -818,7 +818,6 @@ static int kwbimage_verify_header(unsigned char *ptr, int image_size,
|
||||||
struct image_tool_params *params)
|
struct image_tool_params *params)
|
||||||
{
|
{
|
||||||
struct main_hdr_v0 *main_hdr;
|
struct main_hdr_v0 *main_hdr;
|
||||||
struct ext_hdr_v0 *ext_hdr;
|
|
||||||
uint8_t checksum;
|
uint8_t checksum;
|
||||||
|
|
||||||
main_hdr = (struct main_hdr_v0 *)ptr;
|
main_hdr = (struct main_hdr_v0 *)ptr;
|
||||||
|
@ -830,6 +829,8 @@ static int kwbimage_verify_header(unsigned char *ptr, int image_size,
|
||||||
|
|
||||||
/* Only version 0 extended header has checksum */
|
/* Only version 0 extended header has checksum */
|
||||||
if (image_version((void *)ptr) == 0) {
|
if (image_version((void *)ptr) == 0) {
|
||||||
|
struct ext_hdr_v0 *ext_hdr;
|
||||||
|
|
||||||
ext_hdr = (struct ext_hdr_v0 *)
|
ext_hdr = (struct ext_hdr_v0 *)
|
||||||
(ptr + sizeof(struct main_hdr_v0));
|
(ptr + sizeof(struct main_hdr_v0));
|
||||||
checksum = image_checksum8(ext_hdr,
|
checksum = image_checksum8(ext_hdr,
|
||||||
|
|
Loading…
Add table
Reference in a new issue