From patchwork Mon Apr 15 19:34:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13630601 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 684C0C4345F for ; Mon, 15 Apr 2024 19:37:17 +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=NOYgilJHVzDrWc6iY200IXLShyzuZ/QaR76S6p1QHJU=; b=EwlO/BuBL5XqmG aJ3iCdP9bKaV9j0052cihdnC7dM70HiVJqkKICixkxNJ8mWIPgQqyBQTPGcNoSLTPSlhyyzGNJaG8 iCTFNxnTQREC1gcoucMUkdatfY0ny8kbrBrxVrhkceAkeT5ERXbRlfghsD+xG67XkZSj1L55tqODR JQnvnBjrJFfpOC4chVhoIXT+7qdLKmJhJXf3iBl4GfNqMA+73n2MWVYdVPtwpVvmecY4MdChGIf1A UHJrUuGWVGtu1yHb0otbWCzYIGghgi+nIIAtFaVm/9LX1AMGnCZUaRHCe+bg4SyXRHePR05wxzTBV khW2eCY7E+v13Z3ZO7Ag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwS8X-00000009dS6-22Pz; Mon, 15 Apr 2024 19:37:05 +0000 Received: from mail-qk1-f169.google.com ([209.85.222.169]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwS6N-00000009c5g-1NNQ for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2024 19:34:55 +0000 Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-78edc3ad5fdso160183585a.0 for ; Mon, 15 Apr 2024 12:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713209689; x=1713814489; 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=Ysx9uvN3ilBy5tFwit8pBZpHwFo890jKkO1ecScbT94=; b=fZA5oeW/VOEiGk99R11vG3vOd9XFD39voraHUOBlLZKiHNa0MmhSsNRO03+D1z2/uN mWtLdcmp8E7hlx2xTAol9kDdOwnRI/I0RRmP/gckTkaSnstFk4QHNDHpj9UGIBOfeT3k dUikhrPmL+yf6KRiNJFc4nxtYdsHq2vnUA2kU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713209689; x=1713814489; 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=Ysx9uvN3ilBy5tFwit8pBZpHwFo890jKkO1ecScbT94=; b=tokRzbX5hZks6XahIBV1rgJL/gOT8l19/hIyAKH7ZfNZg0Jt5vaurIvxhP5aHX2q5M ZYx3haAUyRD1CN/Xaq9J5nW/1zszI7tcV1CpI8iMnsPjb6stD01ZQ4Mnj6yDXVgwPmrc lUHirqAJx/aKWbiW78dA+6HdY/2xDffFXBhRJpa7U7G7JVmKkruxHaJxMewsJdx0z/RB NIvOEWzELL3vpfeoZXzDuzliJtjH2oPLEwo176uB917GvWhgpHCSD0zrA/KPmkZWLnMM ZKbbJgC17e3ZW8HWbOmcHbsLVmaUhcjoAj2vE4r5LJOCQo5SrPA0HvQCycKm+9TuQJ+P 6Rdg== X-Forwarded-Encrypted: i=1; AJvYcCU6ExI5BRZd2ZvUs4kaCw/8+ARRyLUqirJH1go4RlY8lfwL/Fbc8enWLWhrDpNc+OlM19hueKrWv1G9zJ4e/MdymwGcZNqyMMlzxVexPJAgZeN7SdA= X-Gm-Message-State: AOJu0Yzpdj17QiiNXQNRLPy14WWZTWv6AKCkmyEQrEmFv9XQ1ZY9qA7W dmddgJMxnb4UQUZDWhNpA3oo5ihoQKGdPLai3Knp6EOJ+ssH/BW2ubva+/pA/w== X-Google-Smtp-Source: AGHT+IHQyP/6IMh0FCNlSBAUIYfTzsci3IX6XU70Oi2xtR2oFiLVlI4GVoQeVlX1sWvOJp1rCpFZ7g== X-Received: by 2002:a37:c244:0:b0:78e:f0d6:3ac0 with SMTP id j4-20020a37c244000000b0078ef0d63ac0mr1060376qkm.31.1713209688866; Mon, 15 Apr 2024 12:34:48 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:34:48 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 15 Apr 2024 19:34:35 +0000 Subject: [PATCH 18/35] media: gspca: cpia1: Use min macro MIME-Version: 1.0 Message-Id: <20240415-fix-cocci-v1-18-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_123451_537314_E3BBB9DF X-CRM114-Status: GOOD ( 11.96 ) 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 Simplifies the code. Found by cocci: drivers/media/usb/gspca/cpia1.c:607:30-31: WARNING opportunity for min() Signed-off-by: Ricardo Ribalda --- drivers/media/usb/gspca/cpia1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c index 5f5fa851ca64..14aaf36cde6e 100644 --- a/drivers/media/usb/gspca/cpia1.c +++ b/drivers/media/usb/gspca/cpia1.c @@ -604,10 +604,8 @@ static int find_over_exposure(int brightness) MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness - FLICKER_BRIGHTNESS_CONSTANT; - if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE) - OverExposure = MaxAllowableOverExposure; - else - OverExposure = FLICKER_ALLOWABLE_OVER_EXPOSURE; + OverExposure = min(MaxAllowableOverExposure, + FLICKER_ALLOWABLE_OVER_EXPOSURE); return OverExposure; }