[PATCH 8/9] [media] tm6000: Use common error handling code in tm6000_start_stream()

SF Markus Elfring
2017-09-15T07:59:49Z

Date: Fri, 15 Sep 2017 07:47:41 +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/tm6000/tm6000-dvb.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c
index 855874134fcf..b45e54d5cab9 100644
--- a/drivers/media/usb/tm6000/tm6000-dvb.c
+++ b/drivers/media/usb/tm6000/tm6000-dvb.c
@@ -134,8 +134,8 @@ static int tm6000_start_stream(struct tm6000_core *dev)

dvb->bulk_urb->transfer_buffer = kzalloc(size, GFP_KERNEL);
if (!dvb->bulk_urb->transfer_buffer) {
- usb_free_urb(dvb->bulk_urb);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto free_urb;
}

usb_fill_bulk_urb(dvb->bulk_urb, dev->udev, pipe,
@@ -160,11 +160,14 @@ static int tm6000_start_stream(struct tm6000_core *dev)
ret);

kfree(dvb->bulk_urb->transfer_buffer);
- usb_free_urb(dvb->bulk_urb);
- return ret;
+ goto free_urb;
}

return 0;
+
+free_urb:
+ usb_free_urb(dvb->bulk_urb);
+ return ret;
}

static void tm6000_stop_stream(struct tm6000_core *dev)
--
2.14.1