Skip to contentSkip to conversation

openrisc: Refactor 16-bit constant relocation

PATCH In review Geert Uytterhoeven 2 participants 2 messages Oct 25, 2013 – Nov 5, 2013 Openrisc architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openrisc: Refactor 16-bit constant relocation

arch/openrisc/kernel/module.c: In function 'apply_relocate_add':
arch/openrisc/kernel/module.c:50:13: warning: assignment from incompatible pointer type arch/openrisc/kernel/module.c:54:13: warning: assignment from incompatible pointer type

Move the pointer increments to the dereference statements to avoid incompatible pointer assignments, and remove superfluous casts.

---
Assembler output is identical before and after patch

 arch/openrisc/kernel/module.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/openrisc/kernel/module.c +2 -4
index 10ff50f0202a..ef872ae4c878 100644
@@ -47,12 +47,10 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
 			*location = value;
 			break;
 		case R_OR32_CONST:
-			location = (uint16_t *)location + 1;
-			*((uint16_t *)location) = (uint16_t) (value);
+			*((uint16_t *)location + 1) = value;
 			break;
 		case R_OR32_CONSTH:
-			location = (uint16_t *)location + 1;
-			*((uint16_t *)location) = (uint16_t) (value >> 16);
+			*((uint16_t *)location + 1) = value >> 16;
 			break;
 		case R_OR32_JUMPTARG:
 			value -= (uint32_t)location;
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 8 lines · Geert Uytterhoeven

arch/openrisc/kernel/module.c: In function 'apply_relocate_add':
arch/openrisc/kernel/module.c:50:13: warning: assignment from incompatible pointer type arch/openrisc/kernel/module.c:54:13: warning: assignment from incompatible pointer type

Move the pointer increments to the dereference statements to avoid incompatible pointer assignments, and remove superfluous casts.

Thanks, Geert. Will apply.

/Jonas