[media] media: venus: helpers: fix variable dereferenced before check
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Thu, 15 Jun 2017 16:31:53 +0000 (13:31 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 20 Jun 2017 11:53:40 +0000 (08:53 -0300)
This fixes a warning found when building the driver with gcc7:

drivers/media/platform/qcom/venus/helpers.c:157
load_per_instance() warn: variable dereferenced before check
'inst' (see line 153)

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/qcom/venus/helpers.c

index f777ef80b9413368db1c75f6275d9836d553a5f4..5f4434c0a8f189c8bda5ca16fc37b04f5bead04a 100644 (file)
@@ -150,14 +150,12 @@ static int intbufs_free(struct venus_inst *inst)
 
 static u32 load_per_instance(struct venus_inst *inst)
 {
-       u32 w = inst->width;
-       u32 h = inst->height;
        u32 mbs;
 
        if (!inst || !(inst->state >= INST_INIT && inst->state < INST_STOP))
                return 0;
 
-       mbs = (ALIGN(w, 16) / 16) * (ALIGN(h, 16) / 16);
+       mbs = (ALIGN(inst->width, 16) / 16) * (ALIGN(inst->height, 16) / 16);
 
        return mbs * inst->fps;
 }