driverdev-devel.linuxdriverproject.org archive mirror
 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; only message in thread
From: Leonid Kushnir @ 2020-10-06 20:29 UTC (permalink / raw)
  Cc: devel, gregkh, linux-kernel, sakari.ailus, mchehab, leonf008,
	linux-media

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

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-06 20:29 UTC | newest]

Thread overview: (only message) (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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).