Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp520018lqt; Fri, 19 Apr 2024 02:50:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6YoKp4Hc8Uk1A/Fg0MsUJ47DfbV/37EogrpQC5DMjNLQ6XVNRIVSY8UKpv+p7ulhCWWFDOP4izCVry0YnuW0dBglOZQMV6EIZ4QCeHQ== X-Google-Smtp-Source: AGHT+IErgEivIIxZSSzZtg1EEZRtZr9xeMMONQ/ni/kkO5T523y0+h7TYakiUxqcUbr/RQj6C+1q X-Received: by 2002:a9d:5a17:0:b0:6eb:7ef9:3e6c with SMTP id v23-20020a9d5a17000000b006eb7ef93e6cmr1565114oth.38.1713520246000; Fri, 19 Apr 2024 02:50:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713520245; cv=pass; d=google.com; s=arc-20160816; b=iB8AA+eXMvhcfR0xggZimlklNmi6DkJQgJ9lhFm9VW9s1gpjueyUdI+Rr7bNiL5kmX FM1a9M0Abam790gRzctvPYSU55yrQZqtEm5CfBjj1vqbrDfq9OxhAR+Afrlp4rMpL35j a1LzVNcwitFhA1pqyxcExrCjh/nKogxgkLzixaMvTjvIL+pujFtGZMxEFYyNOE/tzHse iYEl/eFX3KcXS+YvO7DudKXqo1nJ0C28168KVQbnXbPNlodfqziHqKDdAPnWTSktnk4s +w5DgAtAGw2KHJ/Y2z5cNC/3ny9pKZtkFA4XN8Gus2s0DOvX8G3BGa+jzStvUS0bcJXB 542A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=2ANA0Ymw4Lt0Uz9R7FMbv4c7Ba86EanvWiJ79X90fJk=; fh=/vfK2FjRJG2Fk3Rk5arLBUN09zUdg9ymR85plrI0gA0=; b=JCul+ucs52MQZn4BePjpEi5+K4Qzw9PaoOt+YbpTiaDhOsBq8M6EywKHnNPaLbq5FW s7liGXVH4BVlkkbF9kMBhrEA1vPT4k1gqmOPtfQ/2Z47FlLI1ibcsvrVdo67n3KZ+8Wo r1QaqaV8up/w9DOYb0R/dEPUXbchgLiM/aJwmZdi6a5BnBvhKs83tc7E7JbUh28RIufC pACBmvcPVtTIw+DXYTmf8aivdegghoyywKBgexWpiOwXYESWmElsn2fg87cAvX3woehh iSPqPt4D2uAsBmpaEE4VSFV6ao55LKvzBSlJVDuAyIWDl3dqStNwgtmjlcTMTs0kVhxB v5Tw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="J/We44Jy"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-151251-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151251-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 14-20020a630e4e000000b005dc858b5b75si2955744pgo.848.2024.04.19.02.50.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151251-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="J/We44Jy"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-151251-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151251-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 802CE283234 for ; Fri, 19 Apr 2024 09:50:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8F3780022; Fri, 19 Apr 2024 09:49:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="J/We44Jy" Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 C512B7EF1E for ; Fri, 19 Apr 2024 09:49:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520167; cv=none; b=kKoUgdv0bPy2oyoLP3e+BXZ2/r9NxdZbkALlsx0bE9P+fEJAD53V8IP164tbDVxPGxK2zdNuooIyVxvQZhVM4KisRm9vTWZ1T7jjnwLnBd1ZZlvsNsGX2czH9hpQ2SoP29j5bcVmJW36oI2shiQnsbMUVdbVEYxTIAqKLrJj9cU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713520167; c=relaxed/simple; bh=4VxVD/ZvDgbL8FzmgqVV94mI8OoBWP6NSF7Mr+JIpbc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K70uUO1aBWzvSWyXbQGaGGGKnwKB5cgtdy87AQSvndaaxxRUpAEmmiAL+X8GS+bIjCv6nxnDhskdnrNS4SocHmGo9yu3KXgEkI3TjRgCwdTvOiPGh80UAaVw2sN/irEzkf5laOHmMd8GS9WHctASwdsyjtDnGdlX3JIVSzG7xlY= 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=J/We44Jy; arc=none smtp.client-ip=209.85.222.170 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 Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-78f0417b36bso122475685a.0 for ; Fri, 19 Apr 2024 02:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713520165; x=1714124965; 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=2ANA0Ymw4Lt0Uz9R7FMbv4c7Ba86EanvWiJ79X90fJk=; b=J/We44JyLH8NjvzFa549SP63qth6k6rboYWuhhVgP5mGZ/ouvSRsLTkDjolDpXyOki ef+P3G4w12ZlaF4MIZN6OKsTG5e7WHYWQCfg8J7dNMH06eyidEmIRRqokMESSc4px+XV W1hKCY99b5dbfmKKJrv1S0mp9Xayu0wKyLz3Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713520165; x=1714124965; 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=2ANA0Ymw4Lt0Uz9R7FMbv4c7Ba86EanvWiJ79X90fJk=; b=CuqJ+lUJ2WwvBtfZ7Iu/ouTXAw16dKXZ03agDNsSnAfVrWmegofD9s5Vqt0HBdImRc GpfeLp7KeDWPHQwfL8QCu2fL3Nvpcl7fRkGnYxKCTRdp6SM6S0+aNaqOCcG/tVhzCSzN zjOF4hgEfPrrTy/1DcLuljcXQSt5g1hKM9Y3vyqGb7nHjMGQlGx2nFwLjI//ZGkVFu/H CscOXThQxUZXp7WF89Ln+wE1FgejMJgaTxYj7PHdROpK4oaQ1uiNXxGUfUbbHDKMCzrD QIiFtXOAZWJHTUZkfdlGggjGwrrbpyLCA2xy0r9InJi1UXOoxVkceROkHEka3t1h+eBS uAvw== X-Forwarded-Encrypted: i=1; AJvYcCWbJG3gOqdc4dTM1nBq+1Y+TzDkESiHNsEC32ctdgAM09BrNg+J2NaK3YrZCDJaOrXI/jhv7Ds9jAlsHkHMgCrcuIRnidrdGIHKudrM X-Gm-Message-State: AOJu0Yz32dmc9a1am1zOR3aNE2kEhsuH6KfX74kul3kCH6oFeQxWf3u6 5xWb1flwyxKbA4BZtTTMOCl5XSTCBMbkGObtmJOg6PnujOmfec40uxr0Xn1ZTg== X-Received: by 2002:a05:620a:984:b0:78d:6b8e:18d with SMTP id x4-20020a05620a098400b0078d6b8e018dmr1691369qkx.64.1713520164849; Fri, 19 Apr 2024 02:49:24 -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 dt14-20020a05620a478e00b0078d735ca917sm1434532qkb.123.2024.04.19.02.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:49:23 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 Apr 2024 09:47:50 +0000 Subject: [PATCH v2 04/26] media: uvcvideo: Use max() macro 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: 7bit Message-Id: <20240419-fix-cocci-v2-4-2119e692309c@chromium.org> References: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> In-Reply-To: <20240419-fix-cocci-v2-0-2119e692309c@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , 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 , Benjamin Mugnier , Sylvain Petinot , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio 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 , Sergey Senozhatsky , Kieran Bingham X-Mailer: b4 0.12.4 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() Reviewed-by: Sergey Senozhatsky Reviewed-by: Kieran Bingham Signed-off-by: Ricardo Ribalda --- 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; -- 2.44.0.769.g3c40516874-goog