diff options
author | Ajay Kaher <ajay.kaher@broadcom.com> | 2024-11-25 10:59:54 +0000 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-11-30 13:01:32 -0800 |
commit | 98337d7c87577ded71114f6976edb70a163e27bc (patch) | |
tree | 1c0e1f5db727ebbef4a893d9d13e41a3e095e61c /drivers/ptp | |
parent | 0a4cc4accf00b49b4728bb7639cb90a6a5b674e2 (diff) | |
download | linux-98337d7c87577ded71114f6976edb70a163e27bc.tar.gz linux-98337d7c87577ded71114f6976edb70a163e27bc.tar.bz2 linux-98337d7c87577ded71114f6976edb70a163e27bc.zip |
ptp: Add error handling for adjfine callback in ptp_clock_adjtime
ptp_clock_adjtime sets ptp->dialed_frequency even when adjfine
callback returns an error. This causes subsequent reads to return
an incorrect value.
Fix this by adding error check before ptp->dialed_frequency is set.
Fixes: 39a8cbd9ca05 ("ptp: remember the adjusted frequency")
Signed-off-by: Ajay Kaher <ajay.kaher@broadcom.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Link: https://patch.msgid.link/20241125105954.1509971-1-ajay.kaher@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/ptp')
-rw-r--r-- | drivers/ptp/ptp_clock.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index c56cd0f63909..77a36e7bddd5 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -150,7 +150,8 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx) if (ppb > ops->max_adj || ppb < -ops->max_adj) return -ERANGE; err = ops->adjfine(ops, tx->freq); - ptp->dialed_frequency = tx->freq; + if (!err) + ptp->dialed_frequency = tx->freq; } else if (tx->modes & ADJ_OFFSET) { if (ops->adjphase) { s32 max_phase_adj = ops->getmaxphase(ops); |