From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD33172 for ; Wed, 8 Sep 2021 11:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1631098575; bh=YY2yCPD5vLXF6o1p4UODyyT1QmHGm6Y/SxZTq/D9uMg=; h=From:To:Cc:Subject:Date:From; b=mYaLZngkt2nB4yE41SBYtnk11sdtwCw7txgKGBz2Q/2CJ0HBC+vnJHdMdqkqjJQiM gQYiAehdspatbT9xsNwpwxOThXCXQztBA4qx3XaJn7L5n3/C/tXVPC5dbwh2QY+ulA kJa/bp4QvEvzzF8d4CSUdarF7Ni73Q03Xmt7Iyio= From: Ondrej Jirman To: Yong Deng , Mauro Carvalho Chehab , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , linux-media@vger.kernel.org (open list:CSI DRIVERS FOR ALLWINNER V3s), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) Cc: Ondrej Jirman Subject: [PATCH] media: sun6i-csi: Allow the video device to be open multiple times Date: Wed, 8 Sep 2021 12:56:09 +0200 Message-Id: <20210908105609.1823449-1-megous@megous.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Previously it was possible, but a recent fix for uninitialized `ret` variable broke this behavior. v4l2_fh_is_singular_file() check is there just to determine whether the power needs to be enabled, and it's not a failure if it returns false. Fixes: ba9139116bc0538 ("media: sun6i-csi: add a missing return code") Signed-off-by: Ondrej Jirman --- drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c index 0129dee798b4..da1f8b2852b7 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c @@ -510,7 +510,7 @@ static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = { static int sun6i_video_open(struct file *file) { struct sun6i_video *video = video_drvdata(file); - int ret; + int ret = 0; if (mutex_lock_interruptible(&video->lock)) return -ERESTARTSYS; @@ -524,10 +524,8 @@ static int sun6i_video_open(struct file *file) goto fh_release; /* check if already powered */ - if (!v4l2_fh_is_singular_file(file)) { - ret = -EBUSY; + if (!v4l2_fh_is_singular_file(file)) goto unlock; - } ret = sun6i_csi_set_power(video->csi, true); if (ret < 0) -- 2.33.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_ALL,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA0A9C433F5 for ; Wed, 8 Sep 2021 10:58:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 81B6161026 for ; Wed, 8 Sep 2021 10:58:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 81B6161026 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LO17d0z7KC8hejW2i75YXkfOw8qnSc+f+1wVbKVWf/A=; b=zX+NnQfV6+nDY/ nAeLcDvTndeIH8SZJaZEZx4ptzLt3ZSnBaUIim+CdGcxEVLf7JJ5C93m+ucacpqnURP2vf5nV9fid njiv4zWCg/tS8Hj+xf90LBcFzWrkf6RpQ39EpShoduj1dTLuA94TyL5DAucvEjmCN2I7nw7XP4bm6 /am2f1E5mAzSp63uaz/VCDvslVINXq4Xw3Lz0UVGcF4Ig/PT+o5gicZJJJstrt30wlXmQY6e7E1tk lNu+bZAUxG6Cz0rRKPGKU1Dh96hP9Ut3Cf6F4C27R4ZHVHr/fXcd5VM+J5GC2/cRp4Ptcffe7tRqN kkENvDwjN9gFxUAZ9mZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNvFk-006SDO-04; Wed, 08 Sep 2021 10:56:28 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mNvFf-006SC4-58 for linux-arm-kernel@lists.infradead.org; Wed, 08 Sep 2021 10:56:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1631098575; bh=YY2yCPD5vLXF6o1p4UODyyT1QmHGm6Y/SxZTq/D9uMg=; h=From:To:Cc:Subject:Date:From; b=mYaLZngkt2nB4yE41SBYtnk11sdtwCw7txgKGBz2Q/2CJ0HBC+vnJHdMdqkqjJQiM gQYiAehdspatbT9xsNwpwxOThXCXQztBA4qx3XaJn7L5n3/C/tXVPC5dbwh2QY+ulA kJa/bp4QvEvzzF8d4CSUdarF7Ni73Q03Xmt7Iyio= From: Ondrej Jirman To: Yong Deng , Mauro Carvalho Chehab , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , linux-media@vger.kernel.org (open list:CSI DRIVERS FOR ALLWINNER V3s), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) Cc: Ondrej Jirman Subject: [PATCH] media: sun6i-csi: Allow the video device to be open multiple times Date: Wed, 8 Sep 2021 12:56:09 +0200 Message-Id: <20210908105609.1823449-1-megous@megous.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210908_035623_551470_57C51A2A X-CRM114-Status: GOOD ( 12.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Previously it was possible, but a recent fix for uninitialized `ret` variable broke this behavior. v4l2_fh_is_singular_file() check is there just to determine whether the power needs to be enabled, and it's not a failure if it returns false. Fixes: ba9139116bc0538 ("media: sun6i-csi: add a missing return code") Signed-off-by: Ondrej Jirman --- drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c index 0129dee798b4..da1f8b2852b7 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c @@ -510,7 +510,7 @@ static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = { static int sun6i_video_open(struct file *file) { struct sun6i_video *video = video_drvdata(file); - int ret; + int ret = 0; if (mutex_lock_interruptible(&video->lock)) return -ERESTARTSYS; @@ -524,10 +524,8 @@ static int sun6i_video_open(struct file *file) goto fh_release; /* check if already powered */ - if (!v4l2_fh_is_singular_file(file)) { - ret = -EBUSY; + if (!v4l2_fh_is_singular_file(file)) goto unlock; - } ret = sun6i_csi_set_power(video->csi, true); if (ret < 0) -- 2.33.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel