Skip to contentSkip to conversation

rockchip: mkimage: Use an existing macro instead of a decimal value

PATCH New Miquel Raynal 2 participants 2 messages Mar 18, 2020 – Mar 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rockchip: mkimage: Use an existing macro instead of a decimal value

Depending on the SoC, a header of four characters is prepended to the image. There is already a macro defining the number of characters:
RK_SPL_HDR_SIZE, so use it instead of hardcoding "4".

---
 tools/rkcommon.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tools/rkcommon.c +4 -2
index 0d908daee80..a80899e2806 100644
@@ -246,11 +246,13 @@ static int rkcommon_parse_header(const void *buf, struct header0_info *header0,
 					   rkcommon_offset_to_spi(hdr1_offset));
 
 	for (i = 0; i < ARRAY_SIZE(spl_infos); i++) {
-		if (!memcmp(&hdr1_sdmmc->magic, spl_infos[i].spl_hdr, 4)) {
+		if (!memcmp(&hdr1_sdmmc->magic, spl_infos[i].spl_hdr,
+			    RK_SPL_HDR_SIZE)) {
 			if (spl_info)
 				*spl_info = &spl_infos[i];
 			return IH_TYPE_RKSD;
-		} else if (!memcmp(&hdr1_spi->magic, spl_infos[i].spl_hdr, 4)) {
+		} else if (!memcmp(&hdr1_spi->magic, spl_infos[i].spl_hdr,
+				   RK_SPL_HDR_SIZE)) {
 			if (spl_info)
 				*spl_info = &spl_infos[i];
 			return IH_TYPE_RKSPI;
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 rockchip: mkimage: Use an existing macro instead of a decimal value

Quoted 5 lines · Miquel Raynal

Depending on the SoC, a header of four characters is prepended to the image. There is already a macro defining the number of characters:
RK_SPL_HDR_SIZE, so use it instead of hardcoding "4".

Thanks,
- Kever

Quoted 24 lines
---
  tools/rkcommon.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
tools/rkcommon.c +4 -2
index 0d908daee80..a80899e2806 100644
@@ -246,11 +246,13 @@ static int rkcommon_parse_header(const void *buf, struct header0_info *header0,
  					   rkcommon_offset_to_spi(hdr1_offset));
 
  	for (i = 0; i < ARRAY_SIZE(spl_infos); i++) {
-		if (!memcmp(&hdr1_sdmmc->magic, spl_infos[i].spl_hdr, 4)) {
+		if (!memcmp(&hdr1_sdmmc->magic, spl_infos[i].spl_hdr,
+			    RK_SPL_HDR_SIZE)) {
  			if (spl_info)
  				*spl_info = &spl_infos[i];
  			return IH_TYPE_RKSD;
-		} else if (!memcmp(&hdr1_spi->magic, spl_infos[i].spl_hdr, 4)) {
+		} else if (!memcmp(&hdr1_spi->magic, spl_infos[i].spl_hdr,
+				   RK_SPL_HDR_SIZE)) {
  			if (spl_info)
  				*spl_info = &spl_infos[i];
  			return IH_TYPE_RKSPI;