From patchwork Mon Apr 15 19:34:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13630709 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 642A5C4345F for ; Mon, 15 Apr 2024 20:45:54 +0000 (UTC) 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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EjAjIx3+Tr5jmyNzm53+R98K1+EF2yUic6zvltCotFU=; b=GCv0vK+e4Eeqld EXiow9gBUI0LcKrmGhQpc4rzL70LhGG73oXT+Kf6eyR++CkKHZTWD5NRI8+keNrbdne1W/PewcPmZ 6f9dmUYsv+4RlnZVEMILaxEfVhxNyhsGzWMj4BiEOC3JMATiwANfrLKZmYdnyDdnZER4MgUKxpQEv lh5tbhGbvHi/FOnEBY8dRSqP2q/u9YT3RjHJG3Zlz8duYK5bh7KsN/Tv63dVOOWi9HC74pPQj1Qcj 79oZ6pWgH92Ei70D1LN5j9RMJmdd/Nv0PT6SOfcavgEUNJB0kv3aqVtNdkD7vyHtYdTKUKA6oDl/w 0I/Jkg9EHG2tiMhjLLXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwTCx-00000009s1P-3RgT; Mon, 15 Apr 2024 20:45:44 +0000 Received: from mail-qk1-x730.google.com ([2607:f8b0:4864:20::730]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwS66-00000009bqK-1KLe for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2024 19:34:38 +0000 Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-78d5b1a34fdso245468485a.2 for ; Mon, 15 Apr 2024 12:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713209671; x=1713814471; darn=lists.infradead.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=0M0QjtxbXw5Jbt1UmA7dF8uJnSqjZdDcQqjFwr3Ktis=; b=gyTDEAfQ2y5Zb3DOFftNToixljDiHIUT1rJKPgzyl2z0iphZvZ0pwSrvsVjDHAICt/ tnX9mCtpkI30Fxo2o+/m5dT/cYwZRBumwWgZxFq4iJhOLRUVjXbzLr1W0bXQ2/cO5ipT sD7gWcPyBx3S78xYDOFd/ZHAXBBq6GwvUeknc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713209671; x=1713814471; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0M0QjtxbXw5Jbt1UmA7dF8uJnSqjZdDcQqjFwr3Ktis=; b=b8VH1htO8t7ygF6yN8K6w+b6A34buzc3QN0p+nPbGW+u5UmTtU/I43Jj3K8rlQzTeA fYFJY829brN5XIByLIFVJ4nwAJqIfvljBDmLhtNBag7r7G6HHC5ClQFTtWEUvEkBXfnE tJYDIVcFzlussJg7xA2gqCKwGAUhxnCqznnkRRS8gO58l4FPXWpr5uJtCBsyvV2QmAjP myF8PrCRQj6IlkzPT4XsXXxQZ51tlNCbVK5akkulopUZEmwlyPrnN2Uy6FglHRfCmzDV QxFsYzqNAOKKXi9go14BI72JV7RItCgN3zmnaiJxYAcow1fAJHNKMu0l6NNsHhNOVT8t H4Tg== X-Forwarded-Encrypted: i=1; AJvYcCUMrdbD3+SChjDu6ug9/j2995PNONgMKlUpL17VcIkH+a79u393JPPBXGOAr/LHb2MNoycwlmoUr5Aj0cHcoAERWelDpqrDZXlPVfhQh8NsrCEFC7g= X-Gm-Message-State: AOJu0YxS+SlrG6nkrHDWnO5KY7YCIMmobBVnynqFQaEskZEHb1SRKDE/ 7KUOIhAEg76x0ZSCfuZ6YXEAQGpiUPthr4LHTH0itt+WroDz4pGXXHo/xHzDGA== X-Google-Smtp-Source: AGHT+IEqj59jRDGSbVB+H5v2oX0HE1xlFJSWXdttWaWsHugr/F+aCppE0zEJT1gUi+zgVZvdSbru2w== X-Received: by 2002:a05:620a:12e1:b0:78d:4424:b286 with SMTP id f1-20020a05620a12e100b0078d4424b286mr11683901qkl.39.1713209671340; Mon, 15 Apr 2024 12:34:31 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id s26-20020ae9f71a000000b0078d3b54eb76sm6718055qkg.78.2024.04.15.12.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:34:31 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 15 Apr 2024 19:34:21 +0000 Subject: [PATCH 04/35] media: uvcvideo: Use max() macro MIME-Version: 1.0 Message-Id: <20240415-fix-cocci-v1-4-477afb23728b@chromium.org> References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> In-Reply-To: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hans Verkuil , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Matthias Brugger , AngeloGioacchino Del Regno , Hans Verkuil , Sergey Kozlov , Abylay Ospan , Ezequiel Garcia , Dmitry Osipenko , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , Benjamin Mugnier , Sylvain Petinot , Jacopo Mondi , Kieran Bingham , Laurent Pinchart , =?utf-8?q?Ni?= =?utf-8?q?klas_S=C3=B6derlund?= , Pavel Machek Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240415_123434_636061_59195AED X-CRM114-Status: GOOD ( 12.82 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It makes the code slightly more clear and makes cocci incredibly happy: drivers/media/usb/uvc/uvc_ctrl.c:839:22-23: WARNING opportunity for max() Signed-off-by: Ricardo Ribalda Reviewed-by: Kieran Bingham Reviewed-by: Sergey Senozhatsky --- drivers/media/usb/uvc/uvc_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index a4a987913430..4b685f883e4d 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -836,7 +836,7 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping, while (1) { u8 byte = *data & mask; value |= offset > 0 ? (byte >> offset) : (byte << (-offset)); - bits -= 8 - (offset > 0 ? offset : 0); + bits -= 8 - max(offset, 0); if (bits <= 0) break;