libtracefs: Fix the errno values of tracefs_tracer_set()

Be consistent with the errno values on error for tracefs_tracer_set(). If
a bad enum is passed in, then EINVAL should be set, not ENODEV. But if the
tracer does not exist, then ENODEV should be set (even though the write
will return EINVAL).

Also fix the setting of errno to negative values. That's done in the
kernel, not user space.

Link: https://lore.kernel.org/linux-trace-devel/20210625221739.1215557-3-rostedt@goodmis.org

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 file changed