lkml.org 
[lkml]   [2017]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 4/5] [media] s2255drv: Use common error handling code in read_pipe_completion()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
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@users.sourceforge.net>
---
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
\
 
 \ /
  Last update: 2017-09-20 19:02    [W:0.059 / U:3.712 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site