lkml.org 
[lkml]   [2017]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 9/9] [media] tm6000: Use common error handling code in tm6000_prepare_isoc()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 15 Sep 2017 08:02:33 +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-video.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
index 0d45f35e1697..bfdeb41ed3a1 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -602,7 +602,5 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev)
- if (!dev->isoc_ctl.transfer_buffer) {
- kfree(dev->isoc_ctl.urb);
- return -ENOMEM;
- }
+ if (!dev->isoc_ctl.transfer_buffer)
+ goto free_urb;

dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %d x %d packets (%d bytes) of %d bytes each to handle %u size\n",
max_packets, num_bufs, sb_size,
@@ -616,7 +614,6 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev)
tm6000_free_urb_buffers(dev);
- kfree(dev->isoc_ctl.urb);
kfree(dev->isoc_ctl.transfer_buffer);
- return -ENOMEM;
+ goto free_urb;
}

/* allocate urbs and transfer buffers */
@@ -646,6 +643,10 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev)
}

return 0;
+
+free_urb:
+ kfree(dev->isoc_ctl.urb);
+ return -ENOMEM;
}

static int tm6000_start_thread(struct tm6000_core *dev)
--
2.14.1
\
 
 \ /
  Last update: 2017-09-15 10:01    [W:0.066 / U:3.332 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site