diff options
| author | Alexandru Ardelean <[email protected]> | 2021-03-22 10:41:35 +0200 |
|---|---|---|
| committer | Jonathan Cameron <[email protected]> | 2021-04-07 08:36:35 +0100 |
| commit | 4c822244bf4a0fc7f0f5120dc4dae4e9aa815ea6 (patch) | |
| tree | 058540e6ebebebae96c7f0fcdebebe8ca09816b2 /tools/perf/scripts/python/export-to-postgresql.py | |
| parent | b3b64e2c1575da5f290e75e2a1d9cac307812222 (diff) | |
iio: buffer: return 0 for buffer getfd ioctl handler
As Lars pointed out, we could either return the FD vs memcpy-ing it to the
userspace data object.
However, this comment exposed a bug. We should return 0 or negative from
these ioctl() handlers. Because an ioctl() handler can also return
IIO_IOCTL_UNHANDLED (which is positive 1), which means that the ioctl()
handler doesn't support this ioctl number. Positive 1 could also be a valid
FD number in some corner cases.
The reason we did this is to be able to differentiate between an error
code and an unsupported ioctl number; for unsupported ioctl numbers, the
main loop should keep going.
Maybe we should change this to a higher negative number, to avoid such
cases when/if we add more ioctl() handlers.
Cc: Lars-Peter Clausen <[email protected]>
Fixes: f73f7f4da5818 ("iio: buffer: add ioctl() to support opening extra buffers for IIO device")
Signed-off-by: Alexandru Ardelean <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jonathan Cameron <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions