[PATCH 3/3] media: staging: atomisp: Corrected error handling in function

2020-10-06 Thread Leonid Kushnir
This patch fixes check of a result of 'power_up()' function call in
function 'gc0310_s_power()' to do "error handling" instead of "success
handling" as Dan Carpenter noted in his comment on the previous patch.
Lines 'return gc0310_init(sd)' and 'return ret' are swapped, and direct
value of 'ret' is checked in IF statement now.

Signed-off-by: Leonid Kushnir 
---
 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index 8201c15b5769..d170d0adfea4 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -874,11 +874,12 @@ static int gc0310_s_power(struct v4l2_subdev *sd, int on)
 
if (on == 0)
return power_down(sd);
+
ret = power_up(sd);
-   if (!ret)
-   return gc0310_init(sd);
+   if (ret)
+   return ret;
 
-   return ret;
+   return gc0310_init(sd);
 }
 
 /*
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] media: staging: atomisp: Removed else branch in function

2020-10-06 Thread Leonid Kushnir
This patch fixes the checkpatch.pl warning :

WARNING: else is not generally useful after a break or return

Expressions under 'else' branch in function 'gc0310_s_power' are
executed whenever the exppression in 'if' is False. Otherwise, return
from function occurs. Therefore, there is no need in 'else', and it has
been removed.

Signed-off-by: Leonid Kushnir 
---
 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index 6be3ee1d93a5..8201c15b5769 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -874,11 +874,10 @@ static int gc0310_s_power(struct v4l2_subdev *sd, int on)
 
if (on == 0)
return power_down(sd);
-   else {
-   ret = power_up(sd);
-   if (!ret)
-   return gc0310_init(sd);
-   }
+   ret = power_up(sd);
+   if (!ret)
+   return gc0310_init(sd);
+
return ret;
 }
 
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] media: staging: atomisp: Fixed allignment to match open parenthesis

2020-10-05 Thread Leonid Kushnir
Moved the parameters of the function '__gc0310_write_reg_is_consecutive'
to the right under open parenthesis to fix warning message from
checkpatch.pl: 'CHECK: Alignment should match open parenthesis'.

Signed-off-by: Leonid Kushnir 
---
 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index 2b71de722ec3..6be3ee1d93a5 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -192,8 +192,8 @@ static int __gc0310_buf_reg_array(struct i2c_client *client,
 }
 
 static int __gc0310_write_reg_is_consecutive(struct i2c_client *client,
-   struct gc0310_write_ctrl *ctrl,
-   const struct gc0310_reg *next)
+struct gc0310_write_ctrl *ctrl,
+const struct gc0310_reg *next)
 {
if (ctrl->index == 0)
return 1;
-- 
2.25.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel