Re: [PATCH net-next v11 14/14] dpll: zl3073x: Add support to get/set frequency on output pins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/16/25 10:14 PM, Ivan Vecera wrote:
> +static int
> +zl3073x_dpll_output_pin_frequency_set(const struct dpll_pin *dpll_pin,
> +				      void *pin_priv,
> +				      const struct dpll_device *dpll,
> +				      void *dpll_priv, u64 frequency,
> +				      struct netlink_ext_ack *extack)
> +{
> +	struct zl3073x_dpll *zldpll = dpll_priv;
> +	struct zl3073x_dev *zldev = zldpll->dev;
> +	struct zl3073x_dpll_pin *pin = pin_priv;
> +	struct device *dev = zldev->dev;
> +	u32 output_n_freq, output_p_freq;
> +	u8 out, signal_format, synth;
> +	u32 cur_div, new_div, ndiv;
> +	u32 synth_freq;
> +	int rc;
> +
> +	out = zl3073x_output_pin_out_get(pin->id);
> +	synth = zl3073x_out_synth_get(zldev, out);
> +	synth_freq = zl3073x_synth_freq_get(zldev, synth);
> +
> +	/* Check the requested frequency divides synth frequency without
> +	 * remainder.
> +	 */
> +	if (synth_freq % (u32)frequency) {

As the frequency comes from user-space and is validated only the DT
info, which in turn is AFAICS imported verbatim into the kernel, I
*think* it would be safer to check for 0 here or at DT info load time.

/P





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux