Patchwork [U-Boot,V3,03/32] imximage: move flash_offset check to common location

login
register
mail settings
Submitter Troy Kisky
Date Oct. 4, 2012, 1:47 a.m.
Message ID <1349315254-21151-4-git-send-email-troy.kisky@boundarydevices.com>
Download mbox | patch
Permalink /patch/188987/
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Comments

Troy Kisky - Oct. 4, 2012, 1:47 a.m.
Both set_imx_hdr_v1 and set_imx_hdr_v2 perform the
same check. Move check to before the set_imx_hdr call.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

---
v3: split into its own patch
---
 tools/imximage.c |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
Stefano Babic - Oct. 8, 2012, 1:19 p.m.
On 04/10/2012 03:47, Troy Kisky wrote:
> Both set_imx_hdr_v1 and set_imx_hdr_v2 perform the
> same check. Move check to before the set_imx_hdr call.
> 
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> 
> ---
> v3: split into its own patch
> ---
>  tools/imximage.c |   19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/tools/imximage.c b/tools/imximage.c
> index bda1a75..3e9ee6a 100644
> --- a/tools/imximage.c
> +++ b/tools/imximage.c
> @@ -203,13 +203,6 @@ static void set_imx_hdr_v1(struct imx_header *imxhdr, uint32_t dcd_len,
>  	dcd_v1_t *dcd_v1 = &hdr_v1->dcd_table;
>  	uint32_t base_offset;
>  
> -	/* Exit if there is no BOOT_FROM field specifying the flash_offset */
> -	if(imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
> -		fprintf(stderr, "Error: Header v1: No BOOT_FROM tag in %s\n",
> -			params->imagename);
> -		exit(EXIT_FAILURE);
> -	}
> -
>  	/* Set magic number */
>  	fhdr_v1->app_code_barker = APP_CODE_BARKER;
>  
> @@ -243,13 +236,6 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
>  	imx_header_v2_t *hdr_v2 = &imxhdr->header.hdr_v2;
>  	flash_header_v2_t *fhdr_v2 = &hdr_v2->fhdr;
>  
> -	/* Exit if there is no BOOT_FROM field specifying the flash_offset */
> -	if(imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
> -		fprintf(stderr, "Error: Header v2: No BOOT_FROM tag in %s\n",
> -			params->imagename);
> -		exit(EXIT_FAILURE);
> -	}
> -
>  	/* Set magic number */
>  	fhdr_v2->header.tag = IVT_HEADER_TAG; /* 0xD1 */
>  	fhdr_v2->header.length = cpu_to_be16(sizeof(flash_header_v2_t));
> @@ -475,6 +461,11 @@ static uint32_t parse_cfg_file(struct imx_header *imxhdr, char *name)
>  	(*set_dcd_rst)(imxhdr, dcd_len, name, lineno);
>  	fclose(fd);
>  
> +	/* Exit if there is no BOOT_FROM field specifying the flash_offset */
> +	if (imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
> +		fprintf(stderr, "Error: No BOOT_FROM tag in %s\n", name);
> +		exit(EXIT_FAILURE);
> +	}
>  	return dcd_len;
>  }
>

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
Troy Kisky - Oct. 18, 2012, 6:40 p.m.
On 10/8/2012 6:19 AM, Stefano Babic wrote:
> On 04/10/2012 03:47, Troy Kisky wrote:
>> Both set_imx_hdr_v1 and set_imx_hdr_v2 perform the
>> same check. Move check to before the set_imx_hdr call.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>>
>> ---
>> v3: split into its own patch
>> ---
>>   tools/imximage.c |   19 +++++--------------
>>   1 file changed, 5 insertions(+), 14 deletions(-)
>>
> Acked-by: Stefano Babic <sbabic@denx.de>
>
> Best regards,
> Stefano Babic
>
>
Are you going to apply this(and 1/32, 2/23) now, or should I resend in the
next version with your ack?

Thanks
Troy
Stefano Babic - Oct. 19, 2012, 8:01 a.m.
Am 18/10/2012 20:40, schrieb Troy Kisky:
> On 10/8/2012 6:19 AM, Stefano Babic wrote:
>> On 04/10/2012 03:47, Troy Kisky wrote:
>>> Both set_imx_hdr_v1 and set_imx_hdr_v2 perform the
>>> same check. Move check to before the set_imx_hdr call.
>>>
>>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>>>
>>> ---
>>> v3: split into its own patch
>>> ---
>>>   tools/imximage.c |   19 +++++--------------
>>>   1 file changed, 5 insertions(+), 14 deletions(-)
>>>
>> Acked-by: Stefano Babic <sbabic@denx.de>
>>
>> Best regards,
>> Stefano Babic
>>
>>
> Are you going to apply this(and 1/32, 2/23) now, or should I resend in the
> next version with your ack?
> 

Hi Troy,

I think the best way to proceed would be if I apply the patches for the
fixes, so that you have not to resend even the patches that will be not
touched. And maybe in this "incremental" way we can speed up the whole
process.

In my ready-to-be-applied list I marked already the patches from 1/32 up
to 5/32. My way to do this is to set them as "under reviewed" in
patchworks, because there is not a "ready-to-be-merged" state.

IMHO even patches up to 9/32 can be applied, they are free of comments
and we discussed about them in your previous posting.
So please wait, I will apply the first set of patches.

Best regards,
Stefano
Stefano Babic - Oct. 20, 2012, 3:46 p.m.
Am 04/10/2012 03:47, schrieb Troy Kisky:
> Both set_imx_hdr_v1 and set_imx_hdr_v2 perform the
> same check. Move check to before the set_imx_hdr call.
> 
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> 
> ---
Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Patch

diff --git a/tools/imximage.c b/tools/imximage.c
index bda1a75..3e9ee6a 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -203,13 +203,6 @@  static void set_imx_hdr_v1(struct imx_header *imxhdr, uint32_t dcd_len,
 	dcd_v1_t *dcd_v1 = &hdr_v1->dcd_table;
 	uint32_t base_offset;
 
-	/* Exit if there is no BOOT_FROM field specifying the flash_offset */
-	if(imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
-		fprintf(stderr, "Error: Header v1: No BOOT_FROM tag in %s\n",
-			params->imagename);
-		exit(EXIT_FAILURE);
-	}
-
 	/* Set magic number */
 	fhdr_v1->app_code_barker = APP_CODE_BARKER;
 
@@ -243,13 +236,6 @@  static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
 	imx_header_v2_t *hdr_v2 = &imxhdr->header.hdr_v2;
 	flash_header_v2_t *fhdr_v2 = &hdr_v2->fhdr;
 
-	/* Exit if there is no BOOT_FROM field specifying the flash_offset */
-	if(imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
-		fprintf(stderr, "Error: Header v2: No BOOT_FROM tag in %s\n",
-			params->imagename);
-		exit(EXIT_FAILURE);
-	}
-
 	/* Set magic number */
 	fhdr_v2->header.tag = IVT_HEADER_TAG; /* 0xD1 */
 	fhdr_v2->header.length = cpu_to_be16(sizeof(flash_header_v2_t));
@@ -475,6 +461,11 @@  static uint32_t parse_cfg_file(struct imx_header *imxhdr, char *name)
 	(*set_dcd_rst)(imxhdr, dcd_len, name, lineno);
 	fclose(fd);
 
+	/* Exit if there is no BOOT_FROM field specifying the flash_offset */
+	if (imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
+		fprintf(stderr, "Error: No BOOT_FROM tag in %s\n", name);
+		exit(EXIT_FAILURE);
+	}
 	return dcd_len;
 }