From patchwork Thu Feb 17 06:07:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 543564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84308C4332F for ; Thu, 17 Feb 2022 06:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235451AbiBQGQI (ORCPT ); Thu, 17 Feb 2022 01:16:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235142AbiBQGQH (ORCPT ); Thu, 17 Feb 2022 01:16:07 -0500 Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90F552A229A for ; Wed, 16 Feb 2022 22:15:52 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id BD7E25801C4; Thu, 17 Feb 2022 01:08:06 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 17 Feb 2022 01:08:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:date:date:from:from:in-reply-to:in-reply-to:message-id :references:reply-to:sender:subject:subject:to:to; s=fm2; bh=ieG gSsTwYsmyQ38bDO+Pn6qhobl81m0tsA+TJpF4PKY=; b=hscWTBcn7IkPjDTYeM+ 7dRyK/PdvcFn7+bd8lnBmFpEh8A07YaQnUP/CVhpF2JyJNZUB6ldeCgS+WTv3wtV F2zTComzTuAXIIDpUuIn8HvlYk2nnl+neQzvq4hrvZ+qmuXSi/A2dt4wLmtQNtGc dcql3pfYyQEa7o9n7gwwo9FowhsRk1hxDMyuCyjA4FbSuMscBOCo/mujKDCy5TZ+ FMndWwDdzLUd3w7fxJycC/BNlvumaDRKNwmpwGpDbCAFzn+2VPJ/HF4Be3XVGLTG oq4vZf7kFJfc9tVBR6ALYjn6rEZlMVXLK3G0riFNKcMmWdcFU0DR06cmcYq7uL9b fSw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:date:date:from:from:in-reply-to :in-reply-to:message-id:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=ieGgSsTwYsmyQ38bDO+Pn6qhobl81m0tsA+TJpF4P KY=; b=BGP3ZFQ126Fq/s+DFV0YOmMcqcyp5djA5aNOPVJVSXGKKjKoOIvHwN3w8 31Pzac83feP4lrzCuhuAQCXXlDNB0vY+ZjxwJA+tF9CJXNJyJN+dV2wtUIOEeBcs QTTv16crwmTZZVBcFz6pVAQwTipUSJQYCsKu/a80tubNVkQYXcXu8iUNSRFXG14r G8zcMshwEIZ8RuHjqPY33uzk/LeqP/fzTCsJ6Cb/ZDZQi4+DZW3PaT+bKbuVl7Eg Yv6nT5Pwo20vNT7BpBjdoYVReMwZGzVf5eQhOhVNCIjyxyi+ECA501BRNw+kxrmT RiUoQBLOudhL7eB0lONKxoJSLvyvg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrjeejgdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfsedttdertdertd dtnecuhfhrohhmpeffrghfnhgrucfjihhrshgthhhfvghlugcuoegurghfnhgrsehfrghs thhmrghilhdrtghomheqnecuggftrfgrthhtvghrnhepheduvdefhfeutdekhedvjeekve ejhedvheelfffftedvledvveeghfehhfffffdtnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepuggrfhhnrgesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 17 Feb 2022 01:08:03 -0500 (EST) From: Dafna Hirschfeld To: ezequiel@vanguardiasur.com.ar Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl, ribalda@chromium.org, tfiga@chromium.org, senozhatsky@google.com, hch@lst.de, dafna@fastmail.com, Dafna Hirschfeld , kernel@collabora.com Subject: [PATCH v3 1/4] media: stk1160: fix number of buffers in case not all buffers are created Date: Thu, 17 Feb 2022 08:07:21 +0200 Message-Id: <20220217060724.7763-2-dafna@fastmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220217060724.7763-1-dafna@fastmail.com> References: <20220217060724.7763-1-dafna@fastmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dafna Hirschfeld In case we fail to allocate a transfer_buffer then we break the buffers creation loop and update the number of buffers to the number of successfully allocated which should be 'i' and not 'i - 1' nor 'i + 1' Signed-off-by: Dafna Hirschfeld Reviewed-by: Ezequiel Garcia --- drivers/media/usb/stk1160/stk1160-video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c index 202b084f65a2..92c8b1fba2b0 100644 --- a/drivers/media/usb/stk1160/stk1160-video.c +++ b/drivers/media/usb/stk1160/stk1160-video.c @@ -511,15 +511,15 @@ int stk1160_alloc_isoc(struct stk1160 *dev) usb_free_urb(dev->isoc_ctl.urb[i]); dev->isoc_ctl.urb[i] = NULL; - stk1160_warn("%d urbs allocated. Trying to continue...\n", i - 1); + stk1160_warn("%d urbs allocated. Trying to continue...\n", i); - dev->isoc_ctl.num_bufs = i - 1; + dev->isoc_ctl.num_bufs = i; return 0; free_i_bufs: /* Save the allocated buffers so far, so we can properly free them */ - dev->isoc_ctl.num_bufs = i+1; + dev->isoc_ctl.num_bufs = i; stk1160_free_isoc(dev); return -ENOMEM; }