[PATCH] ptp: ocp: Fix typo using index 1 instead of i in SMA initialization loop

Jiasheng Jiang posted 1 patch 12 hours ago
drivers/ptp/ptp_ocp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] ptp: ocp: Fix typo using index 1 instead of i in SMA initialization loop
Posted by Jiasheng Jiang 12 hours ago
In ptp_ocp_sma_fb_init(), the code mistakenly used bp->sma[1]
instead of bp->sma[i] inside a for-loop, which caused only SMA[1]
to have its DIRECTION_CAN_CHANGE capability cleared. This led to
inconsistent capability flags across SMA pins.

Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 794ec6e71990..a5c363252986 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -2548,7 +2548,7 @@ ptp_ocp_sma_fb_init(struct ptp_ocp *bp)
 		for (i = 0; i < OCP_SMA_NUM; i++) {
 			bp->sma[i].fixed_fcn = true;
 			bp->sma[i].fixed_dir = true;
-			bp->sma[1].dpll_prop.capabilities &=
+			bp->sma[i].dpll_prop.capabilities &=
 				~DPLL_PIN_CAPABILITIES_DIRECTION_CAN_CHANGE;
 		}
 		return;
-- 
2.25.1
Re: [PATCH] ptp: ocp: Fix typo using index 1 instead of i in SMA initialization loop
Posted by Vadim Fedorenko 11 hours ago
On 21/10/2025 19:24, Jiasheng Jiang wrote:
> In ptp_ocp_sma_fb_init(), the code mistakenly used bp->sma[1]
> instead of bp->sma[i] inside a for-loop, which caused only SMA[1]
> to have its DIRECTION_CAN_CHANGE capability cleared. This led to
> inconsistent capability flags across SMA pins.
> 
> Fixes: 09eeb3aecc6c ("ptp_ocp: implement DPLL ops")
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
> ---
>   drivers/ptp/ptp_ocp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index 794ec6e71990..a5c363252986 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
> @@ -2548,7 +2548,7 @@ ptp_ocp_sma_fb_init(struct ptp_ocp *bp)
>   		for (i = 0; i < OCP_SMA_NUM; i++) {
>   			bp->sma[i].fixed_fcn = true;
>   			bp->sma[i].fixed_dir = true;
> -			bp->sma[1].dpll_prop.capabilities &=
> +			bp->sma[i].dpll_prop.capabilities &=
>   				~DPLL_PIN_CAPABILITIES_DIRECTION_CAN_CHANGE;
>   		}
>   		return;

Thanks!

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>