staging: media: davinci_vpfe: remove ret variable in switch statements
authorThaissa Falbo <thaissa.falbo@gmail.com>
Thu, 18 Feb 2016 21:17:54 +0000 (19:17 -0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Feb 2016 22:56:47 +0000 (14:56 -0800)
Remove ret variable in functions that used it to determine the return.
Simplified the return logic for these functions.

Found with Coccinelle script:

@@
local idexpression ret;
expression c,d;
identifier label;
@@

switch ( ... ) {
case label :
...
- ret = c;
- break;
+ return c;
...
default:
...
- ret = d;
+ return d;
...
}
... when != ret
- return ret;

@@
type T; identifier i;
@@
- T i;
... when != i

Signed-off-by: Thaissa Falbo <thaissa.falbo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/davinci_vpfe/dm365_ipipe.c
drivers/staging/media/davinci_vpfe/dm365_isif.c

index ac78ed2f8bccaa650d27b0620f52e2b0715bc265..ff47a8f369fc173e195488a6ec365d6dce71409f 100644 (file)
@@ -1350,21 +1350,16 @@ error:
  */
 static long ipipe_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
 {
-       int ret = 0;
-
        switch (cmd) {
        case VIDIOC_VPFE_IPIPE_S_CONFIG:
-               ret = ipipe_s_config(sd, arg);
-               break;
+               return ipipe_s_config(sd, arg);
 
        case VIDIOC_VPFE_IPIPE_G_CONFIG:
-               ret = ipipe_g_config(sd, arg);
-               break;
+               return ipipe_g_config(sd, arg);
 
        default:
-               ret = -ENOIOCTLCMD;
+               return -ENOIOCTLCMD;
        }
-       return ret;
 }
 
 void vpfe_ipipe_enable(struct vpfe_device *vpfe_dev, int en)
index 9b285137fbc5988fd680b0c3c0d90a1e76d498ba..ae9202ded59fa59a38be084ede2cfc93f10e3703 100644 (file)
@@ -626,21 +626,16 @@ static int isif_set_params(struct v4l2_subdev *sd, void *params)
  */
 static long isif_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
 {
-       int ret;
-
        switch (cmd) {
        case VIDIOC_VPFE_ISIF_S_RAW_PARAMS:
-               ret = isif_set_params(sd, arg);
-               break;
+               return isif_set_params(sd, arg);
 
        case VIDIOC_VPFE_ISIF_G_RAW_PARAMS:
-               ret = isif_get_params(sd, arg);
-               break;
+               return isif_get_params(sd, arg);
 
        default:
-               ret = -ENOIOCTLCMD;
+               return -ENOIOCTLCMD;
        }
-       return ret;
 }
 
 static void isif_config_gain_offset(struct vpfe_isif_device *isif)