xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/gen-errors.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun.. _gen_errors:
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun*******************
6*4882a593SmuzhiyunGeneric Error Codes
7*4882a593Smuzhiyun*******************
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun.. _gen-errors:
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun.. flat-table:: Generic error codes
15*4882a593Smuzhiyun    :header-rows:  0
16*4882a593Smuzhiyun    :stub-columns: 0
17*4882a593Smuzhiyun    :widths: 1 16
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun    -  -  ``EAGAIN`` (aka ``EWOULDBLOCK``)
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun       -  The ioctl can't be handled because the device is in state where it
23*4882a593Smuzhiyun	  can't perform it. This could happen for example in case where
24*4882a593Smuzhiyun	  device is sleeping and ioctl is performed to query statistics. It
25*4882a593Smuzhiyun	  is also returned when the ioctl would need to wait for an event,
26*4882a593Smuzhiyun	  but the device was opened in non-blocking mode.
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun    -  -  ``EBADF``
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun       -  The file descriptor is not a valid.
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun    -  -  ``EBUSY``
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun       -  The ioctl can't be handled because the device is busy. This is
35*4882a593Smuzhiyun	  typically return while device is streaming, and an ioctl tried to
36*4882a593Smuzhiyun	  change something that would affect the stream, or would require
37*4882a593Smuzhiyun	  the usage of a hardware resource that was already allocated. The
38*4882a593Smuzhiyun	  ioctl must not be retried without performing another action to fix
39*4882a593Smuzhiyun	  the problem first (typically: stop the stream before retrying).
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun    -  -  ``EFAULT``
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun       -  There was a failure while copying data from/to userspace, probably
44*4882a593Smuzhiyun	  caused by an invalid pointer reference.
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun    -  -  ``EINVAL``
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun       -  One or more of the ioctl parameters are invalid or out of the
49*4882a593Smuzhiyun	  allowed range. This is a widely used error code. See the
50*4882a593Smuzhiyun	  individual ioctl requests for specific causes.
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun    -  -  ``ENODEV``
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun       -  Device not found or was removed.
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun    -  -  ``ENOMEM``
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun       -  There's not enough memory to handle the desired operation.
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun    -  -  ``ENOTTY``
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun       -  The ioctl is not supported by the driver, actually meaning that
63*4882a593Smuzhiyun	  the required functionality is not available, or the file
64*4882a593Smuzhiyun	  descriptor is not for a media device.
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun    -  -  ``ENOSPC``
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun       -  On USB devices, the stream ioctl's can return this error, meaning
69*4882a593Smuzhiyun	  that this request would overcommit the usb bandwidth reserved for
70*4882a593Smuzhiyun	  periodic transfers (up to 80% of the USB bandwidth).
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun    -  -  ``EPERM``
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun       -  Permission denied. Can be returned if the device needs write
75*4882a593Smuzhiyun	  permission, or some special capabilities is needed (e. g. root)
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun    -  -  ``EIO``
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun       -  I/O error. Typically used when there are problems communicating with
80*4882a593Smuzhiyun          a hardware device. This could indicate broken or flaky hardware.
81*4882a593Smuzhiyun	  It's a 'Something is wrong, I give up!' type of error.
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun    -  - ``ENXIO``
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun       -  No device corresponding to this device special file exists.
86*4882a593Smuzhiyun
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun.. note::
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun  #. This list is not exhaustive; ioctls may return other error codes.
91*4882a593Smuzhiyun     Since errors may have side effects such as a driver reset,
92*4882a593Smuzhiyun     applications should abort on unexpected errors, or otherwise
93*4882a593Smuzhiyun     assume that the device is in a bad state.
94*4882a593Smuzhiyun
95*4882a593Smuzhiyun  #. Request-specific error codes are listed in the individual
96*4882a593Smuzhiyun     requests descriptions.
97