From patchwork Wed May 26 15:55:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 3500 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Wed, 26 May 2010 15:56:36 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Wed, 26 May 2010 13:00:39 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1OHIyC-00079r-7B; Wed, 26 May 2010 15:56:36 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756647Ab0EZPzd (ORCPT + 1 other); Wed, 26 May 2010 11:55:33 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:40704 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755284Ab0EZPza (ORCPT ); Wed, 26 May 2010 11:55:30 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id C5EF119BBD2; Wed, 26 May 2010 17:55:29 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12904-06; Wed, 26 May 2010 17:55:25 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id 97D4C19BBDF; Wed, 26 May 2010 17:55:25 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id DAF226DFD05; Wed, 26 May 2010 17:47:59 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3767) id 7B03C200BF; Wed, 26 May 2010 17:55:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 7682B200BC; Wed, 26 May 2010 17:55:25 +0200 (CEST) Date: Wed, 26 May 2010 17:55:25 +0200 (CEST) From: Julia Lawall To: Mike Isely , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 5/17] drivers/media/video/pvrusb2: Add missing mutex_unlock Message-ID: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Julia Lawall Add a mutex_unlock missing on the error path. In the other functions in the same file the locks and unlocks of this mutex appear to be balanced, so it would seem that the same should hold in this case. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression E1; @@ * mutex_lock(E1,...); <+... when != E1 if (...) { ... when != E1 * return ...; } ...+> * mutex_unlock(E1,...); // Signed-off-by: Julia Lawall Acked-By: Mike Isely --- drivers/media/video/pvrusb2/pvrusb2-ioread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.c b/drivers/media/video/pvrusb2/pvrusb2-ioread.c index b482478..bba6115 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ioread.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.c @@ -223,7 +223,10 @@ int pvr2_ioread_setup(struct pvr2_ioread *cp,struct pvr2_stream *sp) " pvr2_ioread_setup (setup) id=%p",cp); pvr2_stream_kill(sp); ret = pvr2_stream_set_buffer_count(sp,BUFFER_COUNT); - if (ret < 0) return ret; + if (ret < 0) { + mutex_unlock(&cp->mutex); + return ret; + } for (idx = 0; idx < BUFFER_COUNT; idx++) { bp = pvr2_stream_get_buffer(sp,idx); pvr2_buffer_set_buffer(bp,