diff mbox

[U-Boot] imx:mx6 fix return value of mxc_get_clock

Message ID 1416714740-15604-1-git-send-email-Peng.Fan@freescale.com
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Commit Message

Peng Fan Nov. 23, 2014, 3:52 a.m. UTC
mxc_get_clock's return type is unsigned int. 'return -1' is same with
'return 0xffffffff', so 0 should be used as the return value when
unsupported mxc_clock type is passed to mxc_get_clock.

Also include an err message when unsupported mxc_clock type is passed
to mxc_get_clock.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
---
 arch/arm/cpu/armv7/mx6/clock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Fabio Estevam Nov. 24, 2014, 12:38 a.m. UTC | #1
On Sun, Nov 23, 2014 at 1:52 AM, Peng Fan <Peng.Fan@freescale.com> wrote:
> mxc_get_clock's return type is unsigned int. 'return -1' is same with
> 'return 0xffffffff', so 0 should be used as the return value when
> unsupported mxc_clock type is passed to mxc_get_clock.
>
> Also include an err message when unsupported mxc_clock type is passed
> to mxc_get_clock.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>

Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
Stefano Babic Dec. 19, 2014, 9:43 a.m. UTC | #2
On 23/11/2014 04:52, Peng Fan wrote:
> mxc_get_clock's return type is unsigned int. 'return -1' is same with
> 'return 0xffffffff', so 0 should be used as the return value when
> unsupported mxc_clock type is passed to mxc_get_clock.
> 
> Also include an err message when unsupported mxc_clock type is passed
> to mxc_get_clock.
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> ---


Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
index 80b11aa..99dba07 100644
--- a/arch/arm/cpu/armv7/mx6/clock.c
+++ b/arch/arm/cpu/armv7/mx6/clock.c
@@ -738,10 +738,11 @@  unsigned int mxc_get_clock(enum mxc_clock clk)
 	case MXC_SATA_CLK:
 		return get_ahb_clk();
 	default:
+		printf("Unsupported MXC CLK: %d\n", clk);
 		break;
 	}
 
-	return -1;
+	return 0;
 }
 
 /*