From patchwork Mon Sep 18 20:12:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9957613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0D1EF60385 for ; Mon, 18 Sep 2017 20:12:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0093A28D85 for ; Mon, 18 Sep 2017 20:12:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E981528D8B; Mon, 18 Sep 2017 20:12:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B345228D85 for ; Mon, 18 Sep 2017 20:12:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751353AbdIRUMi (ORCPT ); Mon, 18 Sep 2017 16:12:38 -0400 Received: from mout.web.de ([217.72.192.78]:61684 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750868AbdIRUMh (ORCPT ); Mon, 18 Sep 2017 16:12:37 -0400 Received: from [192.168.1.2] ([78.48.130.71]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MdLsF-1ddKtr0UBX-00IYE6; Mon, 18 Sep 2017 22:12:28 +0200 Subject: [PATCH 2/2] [media] vicam: Return directly after a failed kmalloc() in vicam_dostream() From: SF Markus Elfring To: linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: <78839a2c-2076-f480-79d3-e783d2f8c0bf@users.sourceforge.net> Message-ID: Date: Mon, 18 Sep 2017 22:12:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <78839a2c-2076-f480-79d3-e783d2f8c0bf@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:w2Sl7ev4y62grc+BdNOCA9HgpUIm9UrBLCFjBCKD5CPlGinEl6y fYJ/BCaVIuCakueptQbonAz2DoNdmL2pTZDvwcQlpqiBKcjUPLbDRLP5CKs4rbmmuzk3M1V pHU1voHn1l2kv3r/pku9DZRoDkRsogAGxBKy4j6fhzpHUzL/SczZUzjDH2D0QYYYu4+XRP1 VJc3L1LtPZee/dVkuFRVw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Og9L3Dqsbl8=:VuwuqVG4dAMckUc9jS1D2V ZJWsNdKkcQHH+7085Y7dVGY51RuZa1uXohfMAV3DFw0DG7IMCN1ajJt/10hLhU8dax0EoVzht GYFRVoy0WJjonGM3JFDUZzcizI4F2o8uCwfaExoydGAqexKt39tFAkAENfu2cLGEJvjk95die FcG6vkIWrTPq6GlfWNYiwJfsn5zXQH2RqYzXqg5EGdxHfAX3HZmd6QmatfZfwvU2ReyQ+nvZy 7hqMkx+xpRzAsj5beVtPXobOiUGAWtH3wCyChCuozIVYHv7L4D3jJ9N6J5OVhfhkBqztZtCBL 6RG8hfVxFOKYVbkJGbonChaJhPQ5KprhdxmJoRGIb71UySwhv/aG/LyuCQBnjvsoNA9pchsaT tqLjUgL8M092PytqKJo22IzsD+hsIUGexXFxbXFh5M7KFQvW08pwJvlGeHQZlbp9KMxvaNMFj d5DaCpe8W2Xs3EC2GTFjSlEZJ0Z6/4k7ksRwaAsmfADRnxUrqhSjPXXioSh3ry3bdY1+ffN4I Qw1+8A4y7Zxxw7Pqc/X5hVDumuWy+gnNYz1yp+rZgVEdqfYh6X4Kq36dzlKAcTi39/CjvnG0a GZYyhECqpPHVxGbp1ejJE8NuL2LZsRrnbNhP7amySYWB9KYjBILBGmvg1aYGk8ICCTlwcUjCF stn4e6snDTGuBdmKgh7xZR52zQ3xJaSHue+3Zpu1E91zQzH558Bcm5oDMulOCUW20Vl8hDjae KDyJVlF5bQOR5soi/2YP2rrHiXpzwhBTvnZQjkt2uKYg8oQOABNLwoulXHOdlYCHBQfH0xwo2 xOzzUIOGYHF4ta+61ANAYP07nnCDYOQLd93QXrcLci2wkxpwUU= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring 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 --- 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); }