Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1650169lqp; Mon, 15 Apr 2024 12:37:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX2XJvhfihAWKE24mLOK5y/9s5YgCmSQezcH5W1tlfsGmZtnERFWn0LRBzmBTKcM+neeYU3SuF/Z7APMdymt770MAwhkwfyZXnhrJfNPQ== X-Google-Smtp-Source: AGHT+IFCzxGlEuiwERaIMIz9do2QMPqedvb+YcESshbgV4WneZxnoe+MX4K5P3pzH21z3oynlxVW X-Received: by 2002:a05:6358:858b:b0:186:bfc6:f329 with SMTP id l11-20020a056358858b00b00186bfc6f329mr6151102rwk.21.1713209853978; Mon, 15 Apr 2024 12:37:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713209853; cv=pass; d=google.com; s=arc-20160816; b=Y30fcNuP7obtkUXYzI7V5p9q1UUBT2gNr6cWUrIgWMW1ZthtHElrRRsTfXFSNesTBT t5bw3lRAiDd7wjVHK0n4U26sJBhcpUpQcWE0cMi9LAYQgVMbvGjSVQ/bEu1nm2PT+cpJ YBnogrglyFkQrDcyDr8/7tDQdQKVgX5ROj6md6hjhw1Oc454L58cj8I8dkesX5glY4FN WaZF4Kq6GTPqxJewxeV49D8WPegfYNOzQFjkxC5ahOF3hbdDTYtK62fqqP0bXwiQzu0H S3Qk3ZZFvGRFNfWBjii8O7Ayduc40x9Of/m3ZZzmEvUN74vMmOS/peKuQjhgTrdMw3RJ bc7w== 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=0M0QjtxbXw5Jbt1UmA7dF8uJnSqjZdDcQqjFwr3Ktis=; fh=4iOONa2B+nk0xo/GkvwazxqvvFUBTAX5Lx69ADj9i7I=; b=yjd545wc0BJkJgQfGI22GZv70mkBm4XIAhSf9wxLGXgzoj2GFchLdTZp9EMNd2AGXP TH7NkY2xf4M2A5VUlz8RKFFwwjEq/ojVMGWf4Mp9dNWpUS6yAiGGC0rCPdEvYoQk6pz0 AFdQMOOX8Sq3IMVH/U7/dtrgPRRpzSY2Ji4LaHjIwtjnBGUfi1najjFTv/WcifIzoIk8 IlkvZagtSNXrICMNSZN94ji9WJ4Fek/YmDhGOlXZCHFh+YR/5q/hsc+ay94IpFNhknw/ DQYWFtbI2GaSyTh9C4AgmtAEOJaepOF6Sm2V6dCoZspoo1JSs/Dz35HMdspaJVRg3G/q +lHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lQYAIu7m; 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-145786-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145786-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. [139.178.88.99]) by mx.google.com with ESMTPS id b75-20020a63344e000000b005f3ffb13a57si8262463pga.532.2024.04.15.12.37.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:37:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145786-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lQYAIu7m; 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-145786-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145786-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 05B7A284ABB for ; Mon, 15 Apr 2024 19:37:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CA8F15AABF; Mon, 15 Apr 2024 19:34:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="lQYAIu7m" Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 45A9D1591F5 for ; Mon, 15 Apr 2024 19:34:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209675; cv=none; b=hiMOZiAZfjoHt/giBqZLeN0uOIzdOUTTDDWuzcCqeB/pgxlq59ZUvd+8g/htLKWvkmwEVEHygX/2P2uJSmHCfnTkXW1OqzyQe7JpgCVdneZgEvBYfoCRNYAAo22vDD1WRJQycoHc7bP0cHiYQCEy2v4d6xfKD66fX4VpCEi63ic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209675; c=relaxed/simple; bh=XObzijZQld/8VXyzVYTREi/3oAcyuDjxYbwKJHTRP9A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TUxWvu9sXAB/VbpsLXrEPQw5OqN0PQdwPfs1y0UGROFaaum+EPUFka2t8gyiNPpAjwwBvLDEypwzUDEd/76YW5hvdBbj2dmVwjz2b6UavWmVwYMkjjEiRQArP8BM663s1uxhZO7udNm4YbhJ1vil+okVjJuCEqPHrIB+y9nj/0A= 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=lQYAIu7m; arc=none smtp.client-ip=209.85.222.175 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-f175.google.com with SMTP id af79cd13be357-78d57bd5781so264746885a.3 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=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=0M0QjtxbXw5Jbt1UmA7dF8uJnSqjZdDcQqjFwr3Ktis=; b=lQYAIu7mvieo1iAS+hmdLRHXa5ByO9OEargwxAE/ZwSQnS+6vXNCpkcwULeP6GyRKX kLk0bBUx3SN1+AIb7YNQ+PnLg+GS6FfDIohtLqiPzL7dm3RsivQvZHpPsrE6PAT6heL8 KDJpfSv2hzjF7IU19uvU2XM+XjRPF9kOGtGkU= 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=tHiiOAnOE3dmePJXTCVd4W8z+VtsEySrFqEbsiuroWe8ozMyA2DSf9MLD8TTD04b7k VV9BIaXNrVI8oxaxzc2UfIy0+q9Cmd03piCJfvYmBNyVPBNNCwrVWs0fhkLwaEcBs4q8 9CrnnIO/S34yQLiqg+uVUG3vqwbTE2VgPK9oj/J3iR1z0WQf8Waj9zfEyyuY9m3CGz1A E2ziNS5+VuwViK29bYnUNOxtdsl6gQThEg025BeobLtUXcfJ09N+HuC/kDgEqJSLvpE8 JBjJFLBf/MhHqjHf09cGYsXBsIGgkRlkWvtb03gQMLUEQsZUD7fojdNW57SxVlYwxqqi //Gw== X-Forwarded-Encrypted: i=1; AJvYcCU2W98EPa0qhm2+UI/AG4jn5eUo1PwvQtRJ9ChyVqUAEQFFcEPInmz04eRPHQL0bjWXLudObC5zOF+da+SkqPOye7/XR8pOnvJAyBsX X-Gm-Message-State: AOJu0Yy8x8hBgqv18g6hGKfErcADQ7PDpelI94SHeOQ2JW51C8MmxtD/ U3Ghlk1icceooBsJ0He5AUIuyp/SXRomtrgMWO+VPMgTqye/MAyKCKMJBMMFIw== 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 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: <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?Niklas_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 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 --- 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.683.g7961c838ac-goog