diff mbox

[U-Boot,v2] common: fix missing function pointer relocation in fixup_cmdtable()

Message ID 1318594107-21167-1-git-send-email-daniel.schwierzeck@googlemail.com
State Superseded, archived
Headers show

Commit Message

Daniel Schwierzeck Oct. 14, 2011, 12:08 p.m. UTC
The command auto-completion does not work on architectures relying
on CONFIG_NEEDS_MANUAL_RELOC like MIPS. Cause is the missing function
pointer fixup for cmd_tbl_t::complete function in fixup_cmdtable().

This patch adds the missing pointer fixup in case of CONFIG_AUTO_COMPLETE
is defined.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
changes for v2:
  use correct type cast

One checkpatch.pl false positive:
  WARNING: line over 80 characters
  #31: FILE: common/command.c:482:
  +				(int (*)(int, char * const [], char, int, char * []))addr;

 common/command.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/common/command.c b/common/command.c
index ddaed68..8023576 100644
--- a/common/command.c
+++ b/common/command.c
@@ -475,6 +475,13 @@  void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
 			cmdtp->help = (char *)addr;
 		}
 #endif
+#ifdef CONFIG_AUTO_COMPLETE
+		if (cmdtp->complete) {
+			addr = (ulong)(cmdtp->complete) + gd->reloc_off;
+			cmdtp->complete =
+				(int (*)(int, char * const [], char, int, char * []))addr;
+		}
+#endif
 		cmdtp++;
 	}
 }