From patchwork Fri Apr 19 09:48:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13636108 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 EC40AC04FFE for ; Fri, 19 Apr 2024 09:53:52 +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=lqPDx9h5k8MiuXqaJRc5EVMlYoESh7nyUE3PFYjgubY=; b=3nhzndqSoPayHZ v1qUknWDeLIHpKbQG3zX1ESu2m5aNdULCMmtCL4SexwmY7g42OQvk2wUUrU0D5x7GP3diPvaQ3/v9 4/5Id61w7zXcVgqM8O1ckEakKEgyhCSOogUJ4dAIb/nJf1izenMELEKBULAcdohOCOUPZ4RyKdzSU nSMeylvm+bcAaPdB/Pj5qibQmQCCxRgGfmLbz97bN3HchGeUHiNjrIaffvF8KyjotU/yeiJuCGJ2F +4luouJv3U/qeu//Kv6JKcQHE1J9/0E2fl4wr2JrsXskkqvqJLT2APxE49cY95PQ9KPqSODOoYed/ Yuz6TaGj+OfUasFQRlDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxkw6-00000005BOR-0dZU; Fri, 19 Apr 2024 09:53:38 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxksM-0000000599b-3tBK for linux-arm-kernel@bombadil.infradead.org; Fri, 19 Apr 2024 09:49:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Cc:To:In-Reply-To:References:Message-Id :Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender :Reply-To:Content-ID:Content-Description; bh=kyue/FRqn/p1WnqrFE53P+Zy+G2t8IVLierFxkwHoc8=; b=RqulXt1aPNJ7T25KxANTHNHEf4 y6KysEA+ZxkJA5RsPQMaukL3r1AaOYzSofhJ09Gpil/r4nOqTnvo6VGB+qNn8baOlkYcQjAJiLhQN fZiuYGfL8KnlTZdouIVSPa3tIDgbMtYoosDN6AsVIB+fWMAm/4ZrDyIKT+0EjDDnpp0kFp50/pPRb 0SxFibO9jz+Gv7/wOsu/ATfOO2SdoiiEQT/IchmLBxG7VqdIrHySqG7J/8t02zeXL2VE+Bd+xPVdB GvvbJRJhl2Ha2jwJ9XpIDfwYpNz69vWwKSwIFXtEn34WI8WtGWg2a0deTBFAzWBseore9aAgZrGxV /8ntqmGQ==; Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxksJ-00000007NhI-1gGQ for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 09:49:45 +0000 Received: by mail-oi1-x235.google.com with SMTP id 5614622812f47-3c732d9383aso589688b6e.0 for ; Fri, 19 Apr 2024 02:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713520180; x=1714124980; 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=kyue/FRqn/p1WnqrFE53P+Zy+G2t8IVLierFxkwHoc8=; b=O1DM6r9JUUb72i8DojfVGiMxlJVex7h8qadGgMyZ1EwxcmPXy1yoYKANzZpdFKYvuf iqXurFj337FOjvRus28ayJFZIVu8xDURgA/HCsINfqE+vIBl4oH4OXMATY5ad6laIIGM xSIjQh2KBvvHe2d/F1Rc3IBHzt6LGbPNMiGHM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713520180; x=1714124980; 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=kyue/FRqn/p1WnqrFE53P+Zy+G2t8IVLierFxkwHoc8=; b=wkEC6VXrephsbTsVZcYFyBaRxB9jTSBwi3CtzQwNJ06ZkafdIPOFJ3QpZ8qpcr4QHW /2g2GgIxOBWCDikExyH/J9CpGi4WhMP4wd79uqJCJj57t2peB3N0x1jO47I9wc92m7gQ yPBi2h41Qhxn9+2rm0qowPaWGZcQYz42tKWSITOFQLyYnrQz5BIwyMjh4mtEtMzVWJ0G LeJZ9SvwnnxUgluuVCXSBn08KGb9Ls5FGMCDQoKLfr94PLhZKrTUcl2btthr1smti+gP /GJ87d19OmmJXH4O5udCSGCbCGsJuQbpJruFC2fNvs9wWKIiLKtm2ymC6ct2oZsDySi9 qV8g== X-Forwarded-Encrypted: i=1; AJvYcCXIaUb4uUyaICDCL8Gz5gzYPCnUVsvM57cbj2hJhMCO0vMtLCyW4FczMsAbdvFzjpBpFW8iHyOEZlpCA1uZncRuWIYEzUweKMHVcytc8zJ2sGv8aw0= X-Gm-Message-State: AOJu0Yz+d05xpaTQbm/oOEPyhd0wHSc0V3MNsE7UIjBqisCflRnTYnLH 87Ch2pzpmpWXZfkZGi87aWLe3QVCTLG/rb/Z4qQ9Kuq/xeMuR+td9DpuO0UTVA== X-Google-Smtp-Source: AGHT+IF05pxTJqI8q4Gija+5b/6oIu70NmHvysRWeLZw4zGGPxVTDlI+xOCyxI7lSqjlpj1TWOe/3w== X-Received: by 2002:a05:6808:60c:b0:3c6:f6c9:6bb6 with SMTP id y12-20020a056808060c00b003c6f6c96bb6mr1556563oih.41.1713520180310; Fri, 19 Apr 2024 02:49:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:49:39 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 19 Apr 2024 09:48:04 +0000 Subject: [PATCH v2 18/26] media: gspca: cpia1: Use min macro MIME-Version: 1.0 Message-Id: <20240419-fix-cocci-v2-18-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 X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240419_104943_488250_3569E2F4 X-CRM114-Status: GOOD ( 10.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 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; }