lkml.org 
[lkml]   [2017]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/2] [media] vicam: Return directly after a failed kmalloc() in vicam_dostream()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 18 Sep 2017 21:56:55 +0200

* Return directly after a call of the function "kmalloc" failed
at the beginning.

* Delete the jump target "exit" which became unnecessary
with this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/media/usb/gspca/vicam.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/gspca/vicam.c b/drivers/media/usb/gspca/vicam.c
index 15b6887a8e97..11508ab283cd 100644
--- a/drivers/media/usb/gspca/vicam.c
+++ b/drivers/media/usb/gspca/vicam.c
@@ -184,7 +184,7 @@ static void vicam_dostream(struct work_struct *work)
HEADER_SIZE;
buffer = kmalloc(frame_sz, GFP_KERNEL | GFP_DMA);
if (!buffer)
- goto exit;
+ return;

while (gspca_dev->present && gspca_dev->streaming) {
#ifdef CONFIG_PM
@@ -205,7 +205,7 @@ static void vicam_dostream(struct work_struct *work)
frame_sz - HEADER_SIZE);
gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
}
-exit:
+
kfree(buffer);
}

--
2.14.1
\
 
 \ /
  Last update: 2017-09-18 22:13    [W:0.033 / U:10.860 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site