[PATCH net-next 1/3] ptp: add debugfs interfaces to loop back the periodic output signal
Vladimir Oltean
vladimir.oltean at nxp.com
Thu Sep 4 23:30:11 AEST 2025
On Wed, Sep 03, 2025 at 04:37:47PM +0800, Wei Fang wrote:
> + buf[len] = '\0';
> + cnt = sscanf(buf, "%u %d", &index, &enable);
> + if (cnt != 2)
> + return -EINVAL;
> +
> + if (index >= ops->n_per_lp)
> + return -EINVAL;
> +
> + err = ops->perout_loopback(ops, index, enable ? 1 : 0);
Why not just reject other 'enable' values than 1 or 0? You make it
impossible for other values like '2' to be used in the future, if they
are currently treated the same as '1'.
Also, signed 'enable' doesn't make much sense.
> + if (err)
> + return err;
> +
> + return count;
> +}
More information about the Linuxppc-dev
mailing list