From patchwork Thu Oct 12 09:42:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 732620 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C29D1CDB46E for ; Thu, 12 Oct 2023 09:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235457AbjJLJml (ORCPT ); Thu, 12 Oct 2023 05:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbjJLJmk (ORCPT ); Thu, 12 Oct 2023 05:42:40 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9904291 for ; Thu, 12 Oct 2023 02:42:38 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40535597f01so7690795e9.3 for ; Thu, 12 Oct 2023 02:42:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697103757; x=1697708557; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=LiF3KTiiR4Oh0BQncYvRim4KBPdpNbmgjcOPih22PDM=; b=R1QtCc4sWAYAi8XBWwY2gft+TDt7f8zy4dwTI+RU6uIbafu7zcm8fyQHFR+m00F4qZ WkIX6KAh/myMdKySsoNUvi1BUl6MBbAq6FxrVBs3jhW6MW1LmaFwG99J6spQAJqzzWST IuhxKyWhkCipYJyyuULbaeK0WneF5UbG4iMroYTSRx+FNVAz/gxbNXE8xlLBPdAJnF0e DZp6u4zsOkfKQzsesnK8bVZW1UVBk9vKae2fSa7Q/2gENbiPGgWnjDzJ+MOkvDSivLKc Kin1NV0G6EJsetp3jt2H+3APUvcLKDhnpcXQXPbvGrbvS3UzdwUvLcMoFkWDWcRgR/0X QewQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697103757; x=1697708557; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LiF3KTiiR4Oh0BQncYvRim4KBPdpNbmgjcOPih22PDM=; b=vyyGIGizSb6lnG6Ul8Thtzmhs1D3vkOATPNRPx41qMcEH95DVp/qrzNEPu54plra4k feNoqjjy6xiZwcefgtsiy5WLyDk19FR/H/UyZD4h+g0Y1YMMjki6BmYPjCcpuP9V1TMY EoATrfJ1NoAq69HbvyYhVJosTpMMgnVIk4go2MOA7sIjJcvqZxEYsExJSgOAQxduuSKm ku+VqBz9YB1JQNBjLdHBOp6q/h36KpoH/GNMaORX1vLM+9pazAK821DsDwIAaYclGOtC EknratYFVBVckJcd/itudDjya/pueOg7X+2odoCbCy5gMP4PgIZq42uwL+LIpshegWOd 7m8g== X-Gm-Message-State: AOJu0YwnOkY7RlV9rZ67/aX/fUUNbZ/3Ncgj8zMVqaXsb9B3Hx/pK/nI oRvctazS4/c4WuHybzSrmRfh8A== X-Google-Smtp-Source: AGHT+IEUeZBQHKosDpFY+aJbO9GwqLCMH9ttZl9nGNPvhZCOXO8mWPbqhMFZage/aeI1+JYeoVyfSQ== X-Received: by 2002:a7b:c84d:0:b0:3fa:934c:8356 with SMTP id c13-20020a7bc84d000000b003fa934c8356mr21790318wml.10.1697103757055; Thu, 12 Oct 2023 02:42:37 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id ay20-20020a05600c1e1400b0040640073d25sm19340499wmb.16.2023.10.12.02.42.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 02:42:36 -0700 (PDT) Date: Thu, 12 Oct 2023 12:42:33 +0300 From: Dan Carpenter To: Robert Foss Cc: Todor Tomov , Bryan O'Donoghue , Andy Gross , Bjorn Andersson , Konrad Dybcio , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] media: qcom: camss: clean up a check Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Imagine that "->vfe_num" is zero, then the subtraction will underflow to UINT_MAX. Plus it's just cleaner to use >= instead. Signed-off-by: Dan Carpenter --- drivers/media/platform/qcom/camss/camss-ispif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c index be9d2f0a10c1..ddfe94377ee5 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -270,7 +270,7 @@ static int ispif_vfe_reset(struct ispif_device *ispif, u8 vfe_id) unsigned long time; u32 val; - if (vfe_id > camss->res->vfe_num - 1) { + if (vfe_id >= camss->res->vfe_num) { dev_err(camss->dev, "Error: asked reset for invalid VFE%d\n", vfe_id); return -ENOENT;