Skip to content

Commit 054fa7a

Browse files
jacob-kellerNipaLocal
authored andcommitted
ptp: ocp: reject unsupported periodic output flags
The ptp_ocp_signal_from_perout() function supports PTP_PEROUT_DUTY_CYCLE and PTP_PEROUT_PHASE. It does not support PTP_PEROUT_ONE_SHOT, but does not reject a request with such an unsupported flag. Add the appropriate check to ensure that unsupported requests are rejected both for PTP_PEROUT_ONE_SHOT as well as any future flags. Fixes: 1aa66a3 ("ptp: ocp: Program the signal generators via PTP_CLK_REQ_PEROUT") Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: NipaLocal <nipa@local>
1 parent 21ec36d commit 054fa7a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/ptp/ptp_ocp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,6 +2090,10 @@ ptp_ocp_signal_from_perout(struct ptp_ocp *bp, int gen,
20902090
{
20912091
struct ptp_ocp_signal s = { };
20922092

2093+
if (req->flags & ~(PTP_PEROUT_DUTY_CYCLE |
2094+
PTP_PEROUT_PHASE))
2095+
return -EOPNOTSUPP;
2096+
20932097
s.polarity = bp->signal[gen].polarity;
20942098
s.period = ktime_set(req->period.sec, req->period.nsec);
20952099
if (!s.period)

0 commit comments

Comments
 (0)