Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp411418iof; Mon, 6 Jun 2022 06:00:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw03Ib+athpxO/Kt3ZU/Y0w2mTL4z8Oi7Yttg+ZVSNdZRIVoi7NC4hcr2+sZU5vlmSN+EzQ X-Received: by 2002:a63:6b4a:0:b0:3fb:b03e:d10 with SMTP id g71-20020a636b4a000000b003fbb03e0d10mr20401287pgc.310.1654520400097; Mon, 06 Jun 2022 06:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654520400; cv=none; d=google.com; s=arc-20160816; b=YbxRqqz2v9E50ymJEuocRw3z8p8WFCNKUEiSIHH2+UFslU8/FtVUhdPFYHztFHSfDq UrgrwOQw9fEgkGc0GoEOGOIM9vTUUzwAj/AKG7zWnWX5mU2G9Nt7SoSsE0w/mkOZAOHr ui+XCxMubzm5AVSHppWUsfsfqlfo5w2MH++j07oMrF3QYUkF6xt0bEkRjrAZqicSw5Mw XLzd051F65367T+GUtvczKgzbNxu6zdyYRN/fFq2E1FZVGOB+ZKsxVSJsgpcPmRbVBiU f+we+RVmXWWMrJraVTHKLSaVeEEtp4u+GqFHFeG+BmwRwBRhheKnWi4mRgWNojEcWHxc 6HXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=RXQHOcuYADV4m35mvPiypMg6NieLrjMhV8vYlW3xYNA=; b=ls2wIoI0+UnKQ4I27aUrJi5n7llIO8gmwS3aiZpU154RkQUGfuYplRnspaqlz+LKqB VhlVQdGFbKo5a4MgOzrQFTUfiFNxwLBRE1D8StLVWFdqVnJnFEl0I+kTs4TfTxQqg2A4 RMIwnAD8vBQsW1oWV2KzPHougKuj4HuSuDWrPXTl+a5Z/WqU0ozHsvl2LgX/TeVAbelb DocmegHRvdznwjBkccTDfvaKeBrJGHfUJzHO+zZDU/+EFOLNU8JG592/LfYZndDK/6Au kiYzvhZUvvTUhTRWU/KI+1j8mnUb+kgFN8KEWJ9pejt/W9O/3+qR/qjj6OZ8v8iE5YU+ DqcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c6-20020a056a00248600b0051bebc3e06bsi11235519pfv.205.2022.06.06.05.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 06:00:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 09A1A24BCE; Mon, 6 Jun 2022 05:53:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237796AbiFFMxT (ORCPT + 99 others); Mon, 6 Jun 2022 08:53:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237772AbiFFMxS (ORCPT ); Mon, 6 Jun 2022 08:53:18 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A04A2497C; Mon, 6 Jun 2022 05:53:17 -0700 (PDT) Received: from canpemm500006.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LGtf86vTGzfbQw; Mon, 6 Jun 2022 20:51:28 +0800 (CST) Received: from container.huawei.com (10.175.104.82) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 6 Jun 2022 20:53:15 +0800 From: Ziyang Xuan To: , , , , , CC: Subject: [PATCH] media: amphion: delete unnecessary NULL check Date: Mon, 6 Jun 2022 21:10:42 +0800 Message-ID: <20220606131042.4052393-1-william.xuanziyang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.82] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/media/platform/amphion/vdec.c | 3 +-- drivers/media/platform/amphion/venc.c | 3 +-- drivers/media/platform/amphion/vpu_cmds.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index 3c02aa2a54aa..09d4f27970ec 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -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); } diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c index 43d61d82f58c..461524dd1e44 100644 --- a/drivers/media/platform/amphion/venc.c +++ b/drivers/media/platform/amphion/venc.c @@ -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); } diff --git a/drivers/media/platform/amphion/vpu_cmds.c b/drivers/media/platform/amphion/vpu_cmds.c index 9b39d77a178d..f4d7ca78a621 100644 --- a/drivers/media/platform/amphion/vpu_cmds.c +++ b/drivers/media/platform/amphion/vpu_cmds.c @@ -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); } -- 2.25.1