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;
> +}

Reply via email to