From patchwork Mon Apr 29 15:04:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 793056 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 23699128823 for ; Mon, 29 Apr 2024 15:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403107; cv=none; b=m2PQ1TlgkKKNZ1AobXofuaT5RzG+WEHuSiPttf9rmFxDSuheV/FbcieaBQdY3RGRwckeYDdY9swXcqFxpZtJI44nU9tu74nQB17A9G/Vlu0I6GuPTz53UzV/74+kHlUtj635o9PUNBnPQaFhXsoDSyzYJXJvdTYyDIBLcx3TlYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403107; c=relaxed/simple; bh=NKspkx+WjefJTC0T9GdQgMYdznykMk+osWwLYrp0b/0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CZEZ0SYyf8fyz7kOMwWoK7182qlIGpszyu8HxhU3KqouRrNwpfKRZDfGvn1X/oGHgV3f1+vus241M0dKM/P8srrZ+sR8nSFQC3AF5YIvF/S+qjR4LWivm0ACREWGKnGwRhW1Cqz0dX9jW4BJnkdNf2TBGabAk37U37CBLe/MCpU= 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=VIEfDDr9; arc=none smtp.client-ip=209.85.222.182 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VIEfDDr9" Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-790e7c02430so152244585a.0 for ; Mon, 29 Apr 2024 08:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714403101; x=1715007901; 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=kyue/FRqn/p1WnqrFE53P+Zy+G2t8IVLierFxkwHoc8=; b=VIEfDDr9Wba4En6N9jQIOSUKpRYyyiHx6LU5M7s+OSEwm96rNAlXTzsA6D2jWC83qg JPWT3rgZQQvg44Ldos7WBa0tCYlSuBu2hbTuhffszJ/c2woZr43Z4D4G3SvRn0MnXsP5 /STEQ79jMIufvUe7sWmhUj77YusCokUqOGN44= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403101; x=1715007901; 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=prKiU6vZUQOwc0/DL9PEk3W0YD1rXpqna5TzxZVliPKJ94Yea3TjeM6Cmy7PQZ+Tfi aM5qzsfRIBhNocLnPRz8Gr/x2c1YKxbOXAZ/moCsOn5EiptjBJPtXHCgi87k42w/u9iU DZWNFEarxRElusoYkrDVYP/tuMg4asWBvhEpJyqK1dHj4q63c8oslp6Od+R8zK4b0T9b nCb7RsmA5j43GDx9oxS1ChkvK/X5Ff81t5mXNLaMISexfYBR9jwW5/anJ9jMgPXT321W jHXhR2HPUbrLXFuCyJrQPIWaRCdH40abxyolThx1Z0PLxdSOoPNaSgYxL09XgGdeT3Jy lOWg== X-Forwarded-Encrypted: i=1; AJvYcCWBl/VL3zdT5F0frcnzcQ+B94MTCbzZqUXcoHgDJ7C8aEFfH6wxcTb2QdE8ImrCgXUdtjvEqE6TqzRasmR3VZS0dE5KJccIHXK1dAmypA== X-Gm-Message-State: AOJu0YwjNUkqhrvjQpRe58+2Cced+UiNlaQt0AhosB8vGXoQSyrxceAP L00B+vCpyDYIm/HirKrfui1bOiZo2FMzdNSA+WagBEYbPvxzOTjcd8QMccOaZQ== X-Google-Smtp-Source: AGHT+IGL4vooVVR+0mzZmPQqvYaly6q1aVJv7Kw4xqkfiCYuQPEweu/zlD5u/57ahvXotSjFXGqNNw== X-Received: by 2002:a05:620a:2059:b0:790:a36b:477d with SMTP id d25-20020a05620a205900b00790a36b477dmr9906478qka.35.1714403101530; Mon, 29 Apr 2024 08:05:01 -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 p7-20020a05620a056700b0078d3b9139edsm10568591qkp.97.2024.04.29.08.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:05:01 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 29 Apr 2024 15:04:57 +0000 Subject: [PATCH v3 18/26] media: gspca: cpia1: Use min macro Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240429-fix-cocci-v3-18-3c4865f5a4b0@chromium.org> References: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> In-Reply-To: <20240429-fix-cocci-v3-0-3c4865f5a4b0@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 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; }