From patchwork Tue Nov 1 08:08:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Songjun Wu X-Patchwork-Id: 9407053 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 DE48A60234 for ; Tue, 1 Nov 2016 08:15:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D061829606 for ; Tue, 1 Nov 2016 08:15:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C35FE29608; Tue, 1 Nov 2016 08:15:00 +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=ham 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 5427029606 for ; Tue, 1 Nov 2016 08:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1167978AbcKAIO6 (ORCPT ); Tue, 1 Nov 2016 04:14:58 -0400 Received: from exsmtp02.microchip.com ([198.175.253.38]:19419 "EHLO email.microchip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1167926AbcKAIO4 (ORCPT ); Tue, 1 Nov 2016 04:14:56 -0400 X-Greylist: delayed 325 seconds by postgrey-1.27 at vger.kernel.org; Tue, 01 Nov 2016 04:14:56 EDT Received: from shaarm01.corp.atmel.com (10.10.76.4) by chn-sv-exch02.mchp-main.com (10.10.76.38) with Microsoft SMTP Server id 14.3.181.6; Tue, 1 Nov 2016 01:09:30 -0700 From: Songjun Wu To: CC: , Songjun Wu , Mauro Carvalho Chehab , , Subject: [PATCH] [media] atmel-isc: release the filehandle if it's not the only one. Date: Tue, 1 Nov 2016 16:08:46 +0800 Message-ID: <1477987726-4257-1-git-send-email-songjun.wu@microchip.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 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 Release the filehandle in 'isc_open' if it's not the only filehandle opened for the associated video_device. Signed-off-by: Songjun Wu --- drivers/media/platform/atmel/atmel-isc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index 8e25d3f..5e08404 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -926,21 +926,21 @@ static int isc_open(struct file *file) if (ret < 0) goto unlock; - if (!v4l2_fh_is_singular_file(file)) - goto unlock; + ret = !v4l2_fh_is_singular_file(file); + if (ret) + goto fh_rel; ret = v4l2_subdev_call(sd, core, s_power, 1); - if (ret < 0 && ret != -ENOIOCTLCMD) { - v4l2_fh_release(file); - goto unlock; - } + if (ret < 0 && ret != -ENOIOCTLCMD) + goto fh_rel; ret = isc_set_fmt(isc, &isc->fmt); - if (ret) { + if (ret) v4l2_subdev_call(sd, core, s_power, 0); - v4l2_fh_release(file); - } +fh_rel: + if (ret) + v4l2_fh_release(file); unlock: mutex_unlock(&isc->lock); return ret;