From patchwork Tue Feb 3 17:45:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 5770531 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7FFC1BF440 for ; Tue, 3 Feb 2015 17:46:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C5BEA20253 for ; Tue, 3 Feb 2015 17:46:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A7142021A for ; Tue, 3 Feb 2015 17:46:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966640AbbBCRq0 (ORCPT ); Tue, 3 Feb 2015 12:46:26 -0500 Received: from mout.web.de ([212.227.15.4]:58952 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966237AbbBCRqX (ORCPT ); Tue, 3 Feb 2015 12:46:23 -0500 Received: from [192.168.1.2] ([78.49.19.127]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MPYMT-1YE2iR1mxF-004lvK; Tue, 03 Feb 2015 18:45:46 +0100 Message-ID: <54D10948.8080309@users.sourceforge.net> Date: Tue, 03 Feb 2015 18:45:44 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Mauro Carvalho Chehab , linux-media@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] [media] stk-webcam: Delete an unnecessary check before the function call "vfree" References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:eICzQK4TPXLUl4Ip60Ox9mv2uZrnALRd5AaXYtRw2wXAx0CCHOA d2x08M4mgn494ipBJa8eWekukl35DpscwqJsbH5z6gb6nR25oIwUt+ic++w269wNIMatiCq MQX3Y84hWfpIRtYM84Cg55W6+khewyQJXP69i42BrEOo0guFZQC09yk5gpijiysMKOOWTXQ 0ZjQAkcTJo+q5qlRYlVfQ== X-UI-Out-Filterresults: notjunk:1; Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 3 Feb 2015 18:36:35 +0100 The vfree() function performs also input parameter validation. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/usb/stkwebcam/stk-webcam.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c index 3588dc3..3686c4e 100644 --- a/drivers/media/usb/stkwebcam/stk-webcam.c +++ b/drivers/media/usb/stkwebcam/stk-webcam.c @@ -556,10 +556,8 @@ static int stk_free_sio_buffers(struct stk_camera *dev) nbufs = dev->n_sbufs; dev->n_sbufs = 0; spin_unlock_irqrestore(&dev->spinlock, flags); - for (i = 0; i < nbufs; i++) { - if (dev->sio_bufs[i].buffer != NULL) - vfree(dev->sio_bufs[i].buffer); - } + for (i = 0; i < nbufs; i++) + vfree(dev->sio_bufs[i].buffer); kfree(dev->sio_bufs); dev->sio_bufs = NULL; return 0;