Patchwork Copy machine descriptor after probe succeed

login
register
mail settings
Submitter bill4carson@gmail.com
Date Dec. 20, 2011, 9:08 a.m.
Message ID <1324372127-8552-2-git-send-email-bill4carson@gmail.com>
Download mbox | patch
Permalink /patch/132369/
State Rejected
Headers show

Comments

bill4carson@gmail.com - Dec. 20, 2011, 9:08 a.m.
From: Bill Carson <bill4carson@gmail.com>

It make more sense to copy machine descriptor AFTER machine probe return
succeed.

Signed-off-by: Bill Carson <bill4carson@gmail.com>
---
 arch/powerpc/kernel/setup-common.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Stephen Rothwell - Dec. 20, 2011, 10:17 a.m.
Hi Bill,

On Tue, 20 Dec 2011 17:08:47 +0800 bill4carson@gmail.com wrote:
>
> From: Bill Carson <bill4carson@gmail.com>
> 
> It make more sense to copy machine descriptor AFTER machine probe return
> succeed.

Some of the platform's probe routines modify the ppc_md structure and so
assume that it is has been popluated before the probe routine is called.
bill4carson@gmail.com - Dec. 21, 2011, 2:15 a.m.
On 2011年12月20日 18:17, Stephen Rothwell wrote:
> Hi Bill,
>
> On Tue, 20 Dec 2011 17:08:47 +0800 bill4carson@gmail.com wrote:
>> From: Bill Carson<bill4carson@gmail.com>
>>
>> It make more sense to copy machine descriptor AFTER machine probe return
>> succeed.
> Some of the platform's probe routines modify the ppc_md structure and so
> assume that it is has been popluated before the probe routine is called.
>
I didn't see the whole picture before :(
thanks for your point.

Patch

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index d426b1d..3362097 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -574,9 +574,9 @@  void probe_machine(void)
 	     machine_id < &__machine_desc_end;
 	     machine_id++) {
 		DBG("  %s ...", machine_id->name);
-		memcpy(&ppc_md, machine_id, sizeof(struct machdep_calls));
-		if (ppc_md.probe()) {
+		if (machine_id->probe()) {
 			DBG(" match !\n");
+			memcpy(&ppc_md, machine_id, sizeof(struct machdep_calls));
 			break;
 		}
 		DBG("\n");