media: amphion: delete unnecessary NULL check
authorZiyang Xuan <william.xuanziyang@huawei.com>
Mon, 6 Jun 2022 13:10:42 +0000 (14:10 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 20 Jun 2022 09:30:36 +0000 (10:30 +0100)
vfree(NULL) is safe. NULL check before vfree() is not needed.
Delete them to simplify the code.

Generated by coccinelle script:
scripts/coccinelle/free/ifnullfree.cocci

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/amphion/vdec.c
drivers/media/platform/amphion/venc.c
drivers/media/platform/amphion/vpu_cmds.c

index 3c02aa2a54aa6c3502465ad7ad71976f0a936ecb..09d4f27970ec04e659d9218546a4c7c2d3dd2a3f 100644 (file)
@@ -1369,8 +1369,7 @@ static void vdec_cleanup(struct vpu_inst *inst)
                return;
 
        vdec = inst->priv;
-       if (vdec)
-               vfree(vdec);
+       vfree(vdec);
        inst->priv = NULL;
        vfree(inst);
 }
index 43d61d82f58c291b83e7093a26124436a3483e9f..461524dd1e441423f1ffa952a54fbadccc119b96 100644 (file)
@@ -919,8 +919,7 @@ static void venc_cleanup(struct vpu_inst *inst)
                return;
 
        venc = inst->priv;
-       if (venc)
-               vfree(venc);
+       vfree(venc);
        inst->priv = NULL;
        vfree(inst);
 }
index 9b39d77a178d7bc1bdbe5db27eb7dec00da7cbd0..f4d7ca78a62122536e073253c118215ea5cad4f5 100644 (file)
@@ -117,8 +117,7 @@ static void vpu_free_cmd(struct vpu_cmd_t *cmd)
 {
        if (!cmd)
                return;
-       if (cmd->pkt)
-               vfree(cmd->pkt);
+       vfree(cmd->pkt);
        vfree(cmd);
 }