staging: atomisp: simplify if statement in atomisp_get_sensor_fps()
authorDaeseok Youn <daeseok.youn@gmail.com>
Mon, 20 Mar 2017 14:42:55 +0000 (14:42 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Mar 2017 07:04:33 +0000 (08:04 +0100)
If v4l2_subdev_call() gets the global frame interval values,
it returned 0 and it could be checked whether numerator is zero or not.

If the numerator is not zero, the fps could be calculated in this function.
If not, it just returns 0.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c

index 0a2df3dc9bcdb3de58d2562c9dd45f143d2417fe..9d44a1dd220ae6b2b2b9af4af06b20b279d4a3f7 100644 (file)
@@ -153,20 +153,18 @@ struct atomisp_acc_pipe *atomisp_to_acc_pipe(struct video_device *dev)
 
 static unsigned short atomisp_get_sensor_fps(struct atomisp_sub_device *asd)
 {
-       struct v4l2_subdev_frame_interval frame_interval;
+       struct v4l2_subdev_frame_interval fi;
        struct atomisp_device *isp = asd->isp;
-       unsigned short fps;
 
-       if (v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
-           video, g_frame_interval, &frame_interval)) {
-               fps = 0;
-       } else {
-               if (frame_interval.interval.numerator)
-                       fps = frame_interval.interval.denominator /
-                           frame_interval.interval.numerator;
-               else
-                       fps = 0;
-       }
+       unsigned short fps = 0;
+       int ret;
+
+       ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
+                              video, g_frame_interval, &fi);
+
+       if (!ret && fi.interval.numerator)
+               fps = fi.interval.denominator / fi.interval.numerator;
+
        return fps;
 }