linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gspca: add a missed return-value check for do_command
@ 2018-12-25  6:31 Kangjie Lu
  0 siblings, 0 replies; only message in thread
From: Kangjie Lu @ 2018-12-25  6:31 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Hans Verkuil, Mauro Carvalho Chehab, linux-media, linux-kernel

do_command() may fail. The fix adds the missed return value of
do_command(). If it fails, returns its error code.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/media/usb/gspca/cpia1.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c
index 2b09af8865f4..23fbda56fc91 100644
--- a/drivers/media/usb/gspca/cpia1.c
+++ b/drivers/media/usb/gspca/cpia1.c
@@ -547,10 +547,14 @@ static int do_command(struct gspca_dev *gspca_dev, u16 command,
 		}
 		if (sd->params.qx3.button) {
 			/* button pressed - unlock the latch */
-			do_command(gspca_dev, CPIA_COMMAND_WriteMCPort,
+			ret = do_command(gspca_dev, CPIA_COMMAND_WriteMCPort,
 				   3, 0xdf, 0xdf, 0);
-			do_command(gspca_dev, CPIA_COMMAND_WriteMCPort,
+			if (ret)
+				return ret;
+			ret = do_command(gspca_dev, CPIA_COMMAND_WriteMCPort,
 				   3, 0xff, 0xff, 0);
+			if (ret)
+				return ret;
 		}
 
 		/* test whether microscope is cradled */
-- 
2.17.2 (Apple Git-113)


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

only message in thread, other threads:[~2018-12-25  6:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-25  6:31 [PATCH] usb: gspca: add a missed return-value check for do_command Kangjie Lu

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).