]> git.itanic.dy.fi Git - linux-stable/commitdiff
media: qcom: camss: clean up a check
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 12 Oct 2023 09:42:33 +0000 (11:42 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 23 Nov 2023 12:34:43 +0000 (13:34 +0100)
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 <dan.carpenter@linaro.org>
Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/qcom/camss/camss-ispif.c

index be9d2f0a10c18cd8108692aebb7766508871169b..ddfe94377ee5315300921bd34c1a610a92054efa 100644 (file)
@@ -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;