Skip to contentSkip to conversation

powerpc, mpc5xx: fix compiler warning

PATCH New Heiko Schocher 2 participants 6 messages Feb 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc, mpc5xx: fix compiler warning

executing "tools/buildman/buildman mpc5xx" drops this warning:

common/spl/spl_nor.c: In function 'spl_nor_load_image':
common/spl/spl_nor.c:26:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

fix this.

---

 common/spl/spl_nor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_nor.c +1 -1
index 2c0e8e0..dcba2e0 100644
@@ -23,7 +23,7 @@ void spl_nor_load_image(void)
 		 * Load Linux from its location in NOR flash to its defined
 		 * location in SDRAM
 		 */
-		header = (const struct image_header *)CONFIG_SYS_OS_BASE;
+		header = (struct image_header *)CONFIG_SYS_OS_BASE;
 
 		if (image_get_os(header) == IH_OS_LINUX) {
 			/* happy - was a Linux */
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 powerpc, mpc5xx: fix compiler warning

Hi Heiko,

Quoted 28 lines · On Tue, 3 Feb 2015 11:10:19 +0100 Heiko Schocher <[email protected]> wrote:

executing "tools/buildman/buildman mpc5xx" drops this warning:

common/spl/spl_nor.c: In function 'spl_nor_load_image':
common/spl/spl_nor.c:26:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

fix this.

---

 common/spl/spl_nor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_nor.c +1 -1
index 2c0e8e0..dcba2e0 100644
@@ -23,7 +23,7 @@ void spl_nor_load_image(void)
 		 * Load Linux from its location in NOR flash to its defined
 		 * location in SDRAM
 		 */
-		header = (const struct image_header *)CONFIG_SYS_OS_BASE;
+		header = (struct image_header *)CONFIG_SYS_OS_BASE;
 
 		if (image_get_os(header) == IH_OS_LINUX) {
 			/* happy - was a Linux */
Signature · 1 line
2.1.0

I think you are doing wrong to just suppress the warning.

Both image_get_os() and spl_parse_image_header() expect "const struct image_header *" argument.

Add "const" to "struct image_header *header;"

Best Regards
Masahiro Yamada

#2 lore raw

PATCH 1/1 powerpc, mpc5xx: fix compiler warning

Hello Masahiro,

Am 03.02.2015 11:53, schrieb Masahiro Yamada:

Quoted 40 lines

Hi Heiko,

Quoted 27 lines · On Tue, 3 Feb 2015 11:10:19 +0100 Heiko Schocher <[email protected]> wrote:

executing "tools/buildman/buildman mpc5xx" drops this warning:

common/spl/spl_nor.c: In function 'spl_nor_load_image':
common/spl/spl_nor.c:26:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

fix this.

---

  common/spl/spl_nor.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_nor.c +1 -2
index 2c0e8e0..dcba2e0 100644
@@ -23,7 +23,7 @@ void spl_nor_load_image(void)
  		 * Load Linux from its location in NOR flash to its defined
  		 * location in SDRAM
  		 */
-		header = (const struct image_header *)CONFIG_SYS_OS_BASE;
+		header = (struct image_header *)CONFIG_SYS_OS_BASE;
 
  		if (image_get_os(header) == IH_OS_LINUX) {
  			/* happy - was a Linux */
--
Quoted 1 line

2.1.0

I think you are doing wrong to just suppress the warning.

Quoted 4 lines

Both image_get_os() and spl_parse_image_header() expect "const struct image_header *" argument.

Add "const" to "struct image_header *header;"

Yep, fixed, thanks!

waiting for more comments before posting v2

bye,
Heiko

Quoted 8 lines

Best Regards
Masahiro Yamada

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH 1/1 powerpc, mpc5xx: fix compiler warning

In reply to Heiko Schocher

Hi Heiko,

Quoted 28 lines · On Tue, 3 Feb 2015 11:10:19 +0100 Heiko Schocher <[email protected]> wrote:

executing "tools/buildman/buildman mpc5xx" drops this warning:

common/spl/spl_nor.c: In function 'spl_nor_load_image':
common/spl/spl_nor.c:26:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

fix this.

---

 common/spl/spl_nor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_nor.c +1 -1
index 2c0e8e0..dcba2e0 100644
@@ -23,7 +23,7 @@ void spl_nor_load_image(void)
 		 * Load Linux from its location in NOR flash to its defined
 		 * location in SDRAM
 		 */
-		header = (const struct image_header *)CONFIG_SYS_OS_BASE;
+		header = (struct image_header *)CONFIG_SYS_OS_BASE;
 
 		if (image_get_os(header) == IH_OS_LINUX) {
 			/* happy - was a Linux */
Signature · 1 line
2.1.0

I forgot to mention this:

This patch is not related to "powerpc, mpc5xx:"
even though you found this when you were building mpc5xx boards.

Please change the prefix of the subject.

Best Regards
Masahiro Yamada

#4 lore raw

PATCH 1/1 powerpc, mpc5xx: fix compiler warning

Hello Mashairo,

Am 03.02.2015 11:56, schrieb Masahiro Yamada:

Quoted 40 lines

Hi Heiko,

Quoted 27 lines · On Tue, 3 Feb 2015 11:10:19 +0100 Heiko Schocher <[email protected]> wrote:

executing "tools/buildman/buildman mpc5xx" drops this warning:

common/spl/spl_nor.c: In function 'spl_nor_load_image':
common/spl/spl_nor.c:26:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

fix this.

---

  common/spl/spl_nor.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_nor.c +1 -2
index 2c0e8e0..dcba2e0 100644
@@ -23,7 +23,7 @@ void spl_nor_load_image(void)
  		 * Load Linux from its location in NOR flash to its defined
  		 * location in SDRAM
  		 */
-		header = (const struct image_header *)CONFIG_SYS_OS_BASE;
+		header = (struct image_header *)CONFIG_SYS_OS_BASE;
 
  		if (image_get_os(header) == IH_OS_LINUX) {
  			/* happy - was a Linux */
--
Quoted 1 line

2.1.0

I forgot to mention this:

Quoted 2 lines

This patch is not related to "powerpc, mpc5xx:"
even though you found this when you were building mpc5xx boards.

Yes ...

Quoted 1 line

Please change the prefix of the subject.

Ok ... what would be correct? "spl, nor" ?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#5 lore raw

PATCH 1/1 powerpc, mpc5xx: fix compiler warning

Hi Heiko,

Quoted 43 lines · On Tue, 03 Feb 2015 12:21:03 +0100 Heiko Schocher <[email protected]> wrote:

Hello Mashairo,

Am 03.02.2015 11:56, schrieb Masahiro Yamada:

Quoted 40 lines

Hi Heiko,

Quoted 27 lines · On Tue, 3 Feb 2015 11:10:19 +0100 Heiko Schocher <[email protected]> wrote:

executing "tools/buildman/buildman mpc5xx" drops this warning:

common/spl/spl_nor.c: In function 'spl_nor_load_image':
common/spl/spl_nor.c:26:10: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

fix this.

---

  common/spl/spl_nor.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_nor.c +1 -2
index 2c0e8e0..dcba2e0 100644
@@ -23,7 +23,7 @@ void spl_nor_load_image(void)
  		 * Load Linux from its location in NOR flash to its defined
  		 * location in SDRAM
  		 */
-		header = (const struct image_header *)CONFIG_SYS_OS_BASE;
+		header = (struct image_header *)CONFIG_SYS_OS_BASE;
 
  		if (image_get_os(header) == IH_OS_LINUX) {
  			/* happy - was a Linux */
--
Quoted 1 line

2.1.0

I forgot to mention this:

Quoted 9 lines
Quoted 2 lines

This patch is not related to "powerpc, mpc5xx:"
even though you found this when you were building mpc5xx boards.

Yes ...

Quoted 1 line

Please change the prefix of the subject.

Ok ... what would be correct? "spl, nor" ?

I have no idea.

I would run "git log common/spl"
to see which prefix is commonly used.

Best Regards
Masahiro Yamada