[PATCH 4/5] [media] s2255drv: Use common error handling code in read_pipe_completion()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Sep 2017 17:45:13 +0200

Add a jump target so that a bit of exception handling can be better
reused at the end of this function.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 drivers/media/usb/s2255/s2255drv.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 29bc73ad7d8a..5a5d5ae833ff 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -2065,11 +2065,9 @@ static void read_pipe_completion(struct urb *purb)
 	pipe_info = purb->context;
-	if (!pipe_info) {
-		dev_err(&purb->dev->dev, "no context!\n");
-		return;
-	}
+	if (!pipe_info)
+		goto report_failure;
+
 	dev = pipe_info->dev;
-	if (!dev) {
-		dev_err(&purb->dev->dev, "no context!\n");
-		return;
-	}
+	if (!dev)
+		goto report_failure;
+
 	status = purb->status;
@@ -2107,6 +2105,9 @@ static void read_pipe_completion(struct urb *purb)
 		dprintk(dev, 2, "%s :complete state 0\n", __func__);
 	}
 	return;
+
+report_failure:
+	dev_err(&purb->dev->dev, "no context!\n");
 }
 
 static int s2255_start_readpipe(struct s2255_dev *dev)
-- 
2.14.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux