diff mbox

[U-Boot,2/2] dm: cmd: Relocate subcommands when MANUAL_RELOC

Message ID eac356d66c7e903d81ca84e1735831d9d43760d8.1449245152.git.michal.simek@xilinx.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Michal Simek Dec. 4, 2015, 4:05 p.m. UTC
Subcommands contain pointers to functions which are not updated when
MANUAL_REALOC is enabled. This patch fix it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 test/dm/cmd_dm.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Simon Glass Dec. 6, 2015, 4:44 p.m. UTC | #1
On 4 December 2015 at 09:05, Michal Simek <michal.simek@xilinx.com> wrote:
> Subcommands contain pointers to functions which are not updated when
> MANUAL_REALOC is enabled. This patch fix it.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  test/dm/cmd_dm.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox

Patch

diff --git a/test/dm/cmd_dm.c b/test/dm/cmd_dm.c
index caff49aa4f62..b6e71091497c 100644
--- a/test/dm/cmd_dm.c
+++ b/test/dm/cmd_dm.c
@@ -46,11 +46,25 @@  static cmd_tbl_t test_commands[] = {
 	U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""),
 };
 
+static __maybe_unused void dm_reloc(void)
+{
+	static int relocated;
+
+	if (!relocated) {
+		fixup_cmdtable(test_commands, ARRAY_SIZE(test_commands));
+		relocated = 1;
+	}
+}
+
 static int do_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	cmd_tbl_t *test_cmd;
 	int ret;
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+	dm_reloc();
+#endif
+
 	if (argc < 2)
 		return CMD_RET_USAGE;
 	test_cmd = find_cmd_tbl(argv[1], test_commands,