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: 733564 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 11D71CDB47E for ; Thu, 12 Oct 2023 09:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235542AbjJLJmm (ORCPT ); Thu, 12 Oct 2023 05:42:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229762AbjJLJml (ORCPT ); Thu, 12 Oct 2023 05:42:41 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B4A89D for ; Thu, 12 Oct 2023 02:42:38 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40666aa674fso7890585e9.0 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=IOdI2pDDM9wD6An0Sb+3z4iskM+V0JREeIW05kUAkxmwExWzklyvW68vVTb66l6Loe 9znrASYPtD/FAtNAsL0zuRs22sgjxygXikC66PiT38R89IpAWgvzoxd7tku1JkyuGiWu 093eAaUqHwpg8YxLgXLa00X91PjLciq1bJJ7mI0Eicvg7wpnK/WJsXT0ZeH60tcERcZN B7kB7DUaDOZo2/IR9lUAzlWAZEut1vzRiLTthOY4TBfgjRgj/+RGu6PbL8ADwVf6AisC U71vXTUhYVS0Btmyx1vxEL4wyYFa5EU5e7Xm4uIte3GNztb4yyNJsiRANtBg1hHIOEib dxsQ== X-Gm-Message-State: AOJu0YzdDCRXZrHw4pP+G9QvHRBxH7dGUI3PNzh9+I/iXcJT5n+is+ZH M6psu1ZJsDslsv9OqjPu6A3ILg== 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-media@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;