Yes so WARN sounds appropriate. It should never happen. I
don't see the issue.
The issue is if there is an userspace application reading the
ioctl and or the sysfs, then the warning will be emitted each
time if the never- happen condition exists. Preferably replace
the WARN_ON by pr_warn_once() as suggested if the bug must be
reported.
Sounds a bit funny 'if the never-happen condition exists' :-)
However, I will be fine with WARN_ON_ONCE(). I think that this
warrants more of a large WARN splat than pr_warn() because it
should never happen.
I believe the two WARN_ON I used here are the "this-should-never-
happen" situations. In my opinion, we are good to keep. But I am
also good with WARN_ON_ONCE for compromise. I wonder if Daniel is
good with this then I can fix them.