From patchwork Wed Feb 22 22:32:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9587513 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 A4E4A602A7 for ; Wed, 22 Feb 2017 22:38:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9417E286B2 for ; Wed, 22 Feb 2017 22:38:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8897B286D5; Wed, 22 Feb 2017 22:38:08 +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,FREEMAIL_FROM, 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 38BA5286B2 for ; Wed, 22 Feb 2017 22:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933783AbdBVWgR (ORCPT ); Wed, 22 Feb 2017 17:36:17 -0500 Received: from smtp03.smtpout.orange.fr ([80.12.242.125]:33067 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933605AbdBVWfN (ORCPT ); Wed, 22 Feb 2017 17:35:13 -0500 Received: from localhost.localdomain ([92.140.226.155]) by mwinf5d79 with ME id nyb81u00S3MnwYU03yb9mR; Wed, 22 Feb 2017 23:35:11 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 22 Feb 2017 23:35:11 +0100 X-ME-IP: 92.140.226.155 From: Christophe JAILLET To: mchehab@kernel.org, wsa-dev@sang-engineering.com, hans.verkuil@cisco.com, kumar.san1093@gmail.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] [media] tm6000: Fix resource freeing in 'tm6000_prepare_isoc()' Date: Wed, 22 Feb 2017 23:32:19 +0100 Message-Id: <20170222223219.13211-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.9.3 X-Antivirus: avast! (VPS 170222-0, 22/02/2017), Outbound message X-Antivirus-Status: Clean 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 'usb_free_urb(urb)' is a no-op, because urb is known to be NULL. It is likelly that releasing resources allocated by 'tm6000_alloc_urb_buffers()' just a few lines above is expected here. This has been spotted by the following coccinelle script: @@ expression ret, x, e; identifier f; @@ * if (x == NULL) { ... when != x = e; ( * f(<+...x...+>); | * ret = f(<+...x...+>); ) ... } Signed-off-by: Christophe JAILLET --- drivers/media/usb/tm6000/tm6000-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c index c4fdc1fa32ef..7e960d0a5b92 100644 --- a/drivers/media/usb/tm6000/tm6000-video.c +++ b/drivers/media/usb/tm6000/tm6000-video.c @@ -631,7 +631,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev) urb = usb_alloc_urb(max_packets, GFP_KERNEL); if (!urb) { tm6000_uninit_isoc(dev); - usb_free_urb(urb); + tm6000_free_urb_buffers(dev); return -ENOMEM; } dev->isoc_ctl.urb[i] = urb;