From nobody Mon Feb 9 12:24:27 2026 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 F1CC338E12E for ; Wed, 14 Jan 2026 10:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768386756; cv=none; b=SIUovj/hhS6L66xzRcf5+gBWrVXGhme/JaUjinJGe1+kikvlmGKg5+y+nm/fr/NP+TuPiIteg450HrQCUlbRdnSO6iuEEP/2O+qtjpFxdUT0odj4ToWGuyPlrOtXAHDu8R1EVEe0Qv+z7QBqukN6qldFVdupEA8DFv3MxRqqdyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768386756; c=relaxed/simple; bh=pCYTDrzs5PZKkR4SCnzv6Jrv3cKoqYJo/QJ8RXsQx54=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PmvLLfhCfdlGJkZdACDTuPumdyAOak8yvJJwiK2IXgQgPnTIUVEnRqrpE5xnAVGN5LTyVcqfnuBd/8+xo68zE0n5/ckEO8FIw6nMCQZ/Psvo0Bzgio49W/FlPZruARE6PVTV+mK7pGtJGWNCV1p8ABW9H9A9UkSa3rUuiWSkvJM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=HCyKEZFb; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HCyKEZFb" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-59b8466b4a8so3922077e87.1 for ; Wed, 14 Jan 2026 02:32:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1768386748; x=1768991548; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=OwbbUWw6Vs8xgqtHC1ZesMYsqb+WhuYt/f5FK2CbCH8=; b=HCyKEZFbNUo7U/rWeKmGUH/4JizI02hxkNEoEAJe4UW77M1dRHrmopEPWwcpDswYLg +YblHadXkss6GpurFE3Lg7ZkCOIU8+7EnU98SpSIk4rspQCy8LKGdFev5UyxNytMuCJh hrzYQKxGzz4hb6hLGQNeqvEhqehWa4qpitC3w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768386748; x=1768991548; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=OwbbUWw6Vs8xgqtHC1ZesMYsqb+WhuYt/f5FK2CbCH8=; b=bsH1TpKgXpQJHkjnQIdBh5D6qWvllW/vHNbSc0upwAtU7QzzpnmEMKhbxm/oVLXcfn VwfbNzpZ6rqSR/Gc4tU6k1JKazQtZTMirBwM4UIUxbitCsFRRLI6z0Yjnz2l+KiW0A8j CTgwosuIrhmfpG1kCo8AePXG7st9shu/SRoxL3quUopG+nKNaSmwVXqstemibm9+TnnA oxT3PYVnGltp1Gukx9z2LDuJm5eGFhOGOyVcWv9bZlow99lKaGjUJXAVqgENiztO9Qb5 owQDJoAuQOXj5/G+brJRAz3dvjioBJc/6HB3N5sPPg6YSVbqe1e5AMW2cEd/wd5H0niU GRXw== X-Forwarded-Encrypted: i=1; AJvYcCX260xRNH/rXN1qKmnOdce4ntB6f+O17tnE9y1kAICt9woKECPDnojbwgb+rODcMlFBKoYKMCV9RR6wul0=@vger.kernel.org X-Gm-Message-State: AOJu0YxuXMsNqSG1AzGuBLa2fxPTNouSP6/EB44wO9Mj00HuW9fsE61B 8jeFtx8lC9CEmwrYN2qFarly6zEEExU5WJLUyawGhG3Y6zB1//K0KrGNqOtK691jFQ== X-Gm-Gg: AY/fxX5KEDJKUeRuh46HxEqjeAd4KkzhduaunSP1PQqpy837fkAF5iydsBe5GVSTg6u ToGsZHa56qbeYjlpyD1k5F38BJNN9BDVqB4NLNVMNenmlewpyeZbKA0KTI9kRPxhiRcqPtdy1Mw j7MNvpnQlQ6jVuFD9Y5RJGkV/lED8otzYKFIJfM1bVifQiKb2GpMts84t8Z0TEq15Cik+nlOLUn 2OvydujMk5cge7SAfMGc/lUWSDvKQkwrtk441fozzARp2e5zX/I6dO0+XBSOOiT259ZqtRaDxwV KFDUgOYADBo53ehzO+sxY/YZSrD9QF5re0b9C113cymGCZjudubNBOmqcsusSGyKL2rDjYnCJlr PI/xV1W3DJ6l3nYJ8CHLVOs1zkJT8F4k6QrvL3r+zI2ALuJpKPRq7SV6jnXP4bg81hLz5HpCr0L h/8vFi40UIWDFJ6KQIPc15nJ1m555KKCI9Lc3WUvNO2/Z1rsiqE2lSSIWt6yDEk41DFMeWsg== X-Received: by 2002:a05:6512:110e:b0:598:f262:1658 with SMTP id 2adb3069b0e04-59ba0f78c4emr643858e87.34.1768386747665; Wed, 14 Jan 2026 02:32:27 -0800 (PST) Received: from ribalda.c.googlers.com (181.105.228.35.bc.googleusercontent.com. [35.228.105.181]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-59ba10411e5sm573981e87.61.2026.01.14.02.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jan 2026 02:32:24 -0800 (PST) From: Ricardo Ribalda Date: Wed, 14 Jan 2026 10:32:15 +0000 Subject: [PATCH 3/3] media: uvcvideo: use min() for npacket calculation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260114-uvc-alloc-urb-v1-3-cedf3fb66711@chromium.org> References: <20260114-uvc-alloc-urb-v1-0-cedf3fb66711@chromium.org> In-Reply-To: <20260114-uvc-alloc-urb-v1-0-cedf3fb66711@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab , Johannes Berg Cc: Laurent Pinchart , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.2 Make the code slightly more appealing by making use of min(). There shall not be any functional change from this patch. Signed-off-by: Ricardo Ribalda --- drivers/media/usb/uvc/uvc_video.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_= video.c index 59eb95a4b70c05b1a12986e908b7e9979b064fd0..db02080f15772e0bc1d5cfcadd3= 2463f4e6ea045 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -1808,9 +1808,7 @@ static int uvc_alloc_urb_buffers(struct uvc_streaming= *stream, * Compute the number of packets. Bulk endpoints might transfer UVC * payloads across multiple URBs. */ - npackets =3D DIV_ROUND_UP(size, psize); - if (npackets > UVC_MAX_PACKETS) - npackets =3D UVC_MAX_PACKETS; + npackets =3D min(UVC_MAX_PACKETS, DIV_ROUND_UP(size, psize)); =20 /* Retry allocations until one succeed. */ for (; npackets > 0; npackets /=3D 2) { --=20 2.52.0.457.g6b5491de43-goog