All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] media: staging: atomisp: Corrected error handling in function
@ 2020-10-06 20:29 ` Leonid Kushnir
  0 siblings, 0 replies; 7+ messages in thread
From: Leonid Kushnir @ 2020-10-06 20:29 UTC (permalink / raw)
  Cc: mchehab, sakari.ailus, gregkh, leonf008, linux-media, devel,
	linux-kernel

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 <leonf008@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-10-17 14:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 20:29 [PATCH 3/3] media: staging: atomisp: Corrected error handling in function Leonid Kushnir
2020-10-06 20:29 ` Leonid Kushnir
2020-10-17 13:58 ` leonf08
2020-10-17 14:02   ` [Outreachy kernel] " Julia Lawall
2020-10-17 14:05   ` Greg KH
2020-10-17 14:49     ` leonf08
2020-10-17 14:59       ` Vaishali Thakkar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.