]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
media: dvb_frontend: fix return values for FE_SET_PROPERTY
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 18 Sep 2017 12:21:37 +0000 (08:21 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 11 Oct 2017 16:58:40 +0000 (12:58 -0400)
There are several problems with regards to the return of
FE_SET_PROPERTY. The original idea were to return per-property
return codes via tvp->result field, and to return an updated
set of values.

However, that never worked. What's actually implemented is:

- the FE_SET_PROPERTY implementation doesn't call .get_frontend
  callback in order to get the actual parameters after return;

- the tvp->result field is only filled if there's no error.
  So, it is always filled with zero;

- FE_SET_PROPERTY doesn't call memdup_user() nor any other
  copy_to_user() function. So, any changes to the properties
  will be lost;

- FE_SET_PROPERTY is declared as a write-only ioctl (IOW).

While we could fix the above, it could cause regressions.

So, let's just assume what the code really does, updating
the documentation accordingly and removing the logic that
would update the discarded tvp->result.

Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Documentation/media/uapi/dvb/fe-get-property.rst
drivers/media/dvb-core/dvb_frontend.c
include/uapi/linux/dvb/frontend.h

index 948d2ba84f2ce0991231f90f2529979802cbc974..b69741d9cedfc30adaa9af94aaaed01adfddcc41 100644 (file)
@@ -48,8 +48,11 @@ depends on the delivery system and on the device:
 
    -  This call requires read/write access to the device.
 
-   -  At return, the values are updated to reflect the actual parameters
-      used.
+.. note::
+
+   At return, the values aren't updated to reflect the actual
+   parameters used. If the actual parameters are needed, an explicit
+   call to ``FE_GET_PROPERTY`` is needed.
 
 -  ``FE_GET_PROPERTY:``
 
index b19f40be0ab2374cbc6422454b25a1b666a4d1ac..5e3bcae477d2426b11b4bf0d18a62a8f3c026968 100644 (file)
@@ -2125,7 +2125,6 @@ static int dvb_frontend_handle_ioctl(struct file *file,
                                kfree(tvp);
                                return err;
                        }
-                       (tvp + i)->result = err;
                }
                kfree(tvp);
                break;
@@ -2170,7 +2169,6 @@ static int dvb_frontend_handle_ioctl(struct file *file,
                                kfree(tvp);
                                return err;
                        }
-                       (tvp + i)->result = err;
                }
 
                if (copy_to_user((void __user *)tvps->props, tvp,
index 861cacd5711fe2dd8f3a63e1e9b44cd4a2f88edb..6bc26f35217b33bdd984a58d79b37090e497c7d3 100644 (file)
@@ -830,7 +830,7 @@ struct dtv_fe_stats {
  * @cmd:       Digital TV command.
  * @reserved:  Not used.
  * @u:         Union with the values for the command.
- * @result:    Result of the command set (currently unused).
+ * @result:    Unused
  *
  * The @u union may have either one of the values below:
  *