[U-Boot] imx-common: rdc-sema: correct return value

Submitted by Peng Fan on April 21, 2017, 8:56 a.m.

Details

Message ID 1492765010-4050-1-git-send-email-peng.fan@nxp.com
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Commit Message

Peng Fan April 21, 2017, 8:56 a.m.
When unlock, if caller is not the sema owner,
return -EACCES, not 1.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 arch/arm/imx-common/rdc-sema.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Babic May 11, 2017, 10:37 a.m.
On 21/04/2017 10:56, Peng Fan wrote:
> When unlock, if caller is not the sema owner,
> return -EACCES, not 1.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  arch/arm/imx-common/rdc-sema.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/imx-common/rdc-sema.c b/arch/arm/imx-common/rdc-sema.c
> index 5df4e02..1d97ac8 100644
> --- a/arch/arm/imx-common/rdc-sema.c
> +++ b/arch/arm/imx-common/rdc-sema.c
> @@ -94,7 +94,7 @@ int imx_rdc_sema_unlock(int per_id)
>  
>  	reg = readb(&imx_rdc_sema->gate[per_id % SEMA_GATES_NUM]);
>  	if ((reg & RDC_SEMA_GATE_GTFSM_MASK) != RDC_SEMA_PROC_ID)
> -		return 1;	/*Not the semaphore owner */
> +		return -EACCES;	/*Not the semaphore owner */
>  
>  	writeb(0x0, &imx_rdc_sema->gate[per_id % SEMA_GATES_NUM]);
>  
> 

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Patch hide | download patch | download mbox

diff --git a/arch/arm/imx-common/rdc-sema.c b/arch/arm/imx-common/rdc-sema.c
index 5df4e02..1d97ac8 100644
--- a/arch/arm/imx-common/rdc-sema.c
+++ b/arch/arm/imx-common/rdc-sema.c
@@ -94,7 +94,7 @@  int imx_rdc_sema_unlock(int per_id)
 
 	reg = readb(&imx_rdc_sema->gate[per_id % SEMA_GATES_NUM]);
 	if ((reg & RDC_SEMA_GATE_GTFSM_MASK) != RDC_SEMA_PROC_ID)
-		return 1;	/*Not the semaphore owner */
+		return -EACCES;	/*Not the semaphore owner */
 
 	writeb(0x0, &imx_rdc_sema->gate[per_id % SEMA_GATES_NUM]);