[1/4] MIPS: generic: Fix machine compatible matching
diff mbox series

Message ID
State Accepted
Delegated to: James Hogan
Headers show
Series
  • MIPS: generic: Fixes for Ranchu platform
Related show

Commit Message

James Hogan Feb. 2, 2018, 10:14 p.m. UTC
We now have a platform (Ranchu) in the "generic" platform which matches
based on the FDT compatible string using mips_machine_is_compatible(),
however that function doesn't stop at a blank struct
of_device_id::compatible as that is an array in the struct, not a
pointer to a string.

Fix the loop completion to check the first byte of the compatible array
rather than the address of the compatible array in the struct.

Fixes: eed0eabd12ef ("MIPS: generic: Introduce generic DT-based board support")
Signed-off-by: James Hogan <>
Reviewed-by: Paul Burton <>
Reviewed-by: Matt Redfearn <>
Cc: Ralf Baechle <>
Cc: 
---
 arch/mips/include/asm/machine.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Aleksandar Markovic Feb. 7, 2018, 4:27 p.m. UTC | #1
> 
> ________________________________________
> From: James Hogan []
> Sent: Friday, February 2, 2018 11:14 PM
> To: Ralf Baechle; 
> Cc: Aleksandar Markovic; Goran Ferenc; Miodrag Dinic; James Hogan
> Subject: [PATCH 1/4] MIPS: generic: Fix machine compatible matching
> 
> We now have a platform (Ranchu) in the "generic" platform which matches
> based on the FDT compatible string using mips_machine_is_compatible(),
> however that function doesn't stop at a blank struct
> of_device_id::compatible as that is an array in the struct, not a
> pointer to a string.
> 
> Fix the loop completion to check the first byte of the compatible array
> rather than the address of the compatible array in the struct.
> 
> Fixes: eed0eabd12ef ("MIPS: generic: Introduce generic DT-based board support")
> Signed-off-by: James Hogan <>
> Reviewed-by: Paul Burton <>
> Reviewed-by: Matt Redfearn <>
> Cc: Ralf Baechle <>
> Cc: 
> ---
>  arch/mips/include/asm/machine.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Aleksandar Markovic <>
Acked-by: Miodrag Dinic <>

Patch
diff mbox series

diff --git a/arch/mips/include/asm/machine.h b/arch/mips/include/asm/machine.h
index e0d9b373d415..f83879dadd1e 100644
--- a/arch/mips/include/asm/machine.h
+++ b/arch/mips/include/asm/machine.h
@@ -52,7 +52,7 @@  mips_machine_is_compatible(const struct mips_machine *mach, const void *fdt)
 	if (!mach->matches)
 		return NULL;
 
-	for (match = mach->matches; match->compatible; match++) {
+	for (match = mach->matches; match->compatible[0]; match++) {
 		if (fdt_node_check_compatible(fdt, 0, match->compatible) == 0)
 			return match;
 	}