Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1514010ybz; Sat, 18 Apr 2020 02:36:02 -0700 (PDT) X-Google-Smtp-Source: APiQypJ8Gj93ebeXZif4PPvY4rIO2/fbhZES497XTWe11klnJSUWSfqr6wByawtJ8kNCvdGXadKX X-Received: by 2002:a05:6402:221c:: with SMTP id cq28mr6198356edb.50.1587202562024; Sat, 18 Apr 2020 02:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587202562; cv=none; d=google.com; s=arc-20160816; b=GOuUyEuNG0ba87NWZptVNklKj+gd4pPOcNU/gbPpLkCVSvelUCGVZRRLXUPWppdBa0 TEtqLXr03rpI60cbQNhyB27VkrEhtczKOZXTzL7BEL1QxJJPUfUO5er6nUJ+d3GFYL98 iuPgqsO57sjPxgfyAvFVZ3bdPqz/rCDBsTIk8cEOXJOO2WrAMmdvmohc+4ZbELKyP5r+ uc2I6H5Bp1CTxnCPM7Pf2ZwBCMz8xQAqT/CHO6l2n9jsvBGMvzhsd7szANtR9Je9RWRC XZMHHH4Odw7KRZhxRrVC+zNUIA4aYGbUPomOy9//rUlUVBrjcQc8RZoy6/ix8XGzQJ7O ZTPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=L0yhXo+/BCnLeFNcf42/6anC+e7gv5dcA8PTXD14iws=; b=U1fNQ/93Ugfieyf5n0ZmTG8PZVTPBXqgelR8UrW14cHDWF2jcVV0+f8bUiR4josKV0 onI4t431gUcOc93HdijJ/wMwYcDIcMZFakNOVwLAOzmbLuaRRwfDeeRl0V2+iHrrD8qN LRbWh6s/VGrT/sUOTNscJOiHGjlOhmEB2TuQll5Yq6QwellO8yEYSC/n9lAS4BigS4WX pAoIoHMg1NEQd6IYAcytKLjJ58VFz4vWPfIhBhqiuAbaI/o7OygLsjZrS2SCpWp6Sujo tc+GFOR0ojkD2puZUZvpsIvJsGXUF+HAYAKywsKYpnllVX7DOBEVRZG+c9cxZUzUtbKG vqrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi24si16902093edb.124.2020.04.18.02.35.39; Sat, 18 Apr 2020 02:36:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726061AbgDRJdX (ORCPT + 99 others); Sat, 18 Apr 2020 05:33:23 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:58614 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725857AbgDRJdW (ORCPT ); Sat, 18 Apr 2020 05:33:22 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C93FDDA43FC81A956E8D; Sat, 18 Apr 2020 17:33:20 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Sat, 18 Apr 2020 17:33:13 +0800 From: Jason Yan To: , , , , , , CC: Hulk Robot Subject: [PATCH] scsi: aic7xxx: aic97xx: remove NULL check before some freeing functions Date: Sat, 18 Apr 2020 17:59:39 +0800 Message-ID: <20200418095939.35626-1-yanaijie@huawei.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the following coccicheck warning: drivers/scsi/aic7xxx/aic79xx_core.c:6186:2-7: WARNING: NULL check before some freeing functions is not needed. drivers/scsi/aic7xxx/aic79xx_core.c:6188:2-7: WARNING: NULL check before some freeing functions is not needed. drivers/scsi/aic7xxx/aic79xx_core.c:6190:2-7: WARNING: NULL check before some freeing functions is not needed. drivers/scsi/aic7xxx/aic79xx_core.c:3666:2-7: WARNING: NULL check before some freeing functions is not needed. drivers/scsi/aic7xxx/aic79xx_core.c:6124:2-7: WARNING: NULL check before some freeing functions is not needed. Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/scsi/aic7xxx/aic79xx_core.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index a336a458c978..72eaad4aef9c 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -3662,8 +3662,7 @@ ahd_free_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel, int force) return; tstate = ahd->enabled_targets[scsi_id]; - if (tstate != NULL) - kfree(tstate); + kfree(tstate); ahd->enabled_targets[scsi_id] = NULL; } #endif @@ -6120,8 +6119,7 @@ ahd_set_unit(struct ahd_softc *ahd, int unit) void ahd_set_name(struct ahd_softc *ahd, char *name) { - if (ahd->name != NULL) - kfree(ahd->name); + kfree(ahd->name); ahd->name = name; } @@ -6182,12 +6180,9 @@ ahd_free(struct ahd_softc *ahd) kfree(ahd->black_hole); } #endif - if (ahd->name != NULL) - kfree(ahd->name); - if (ahd->seep_config != NULL) - kfree(ahd->seep_config); - if (ahd->saved_stack != NULL) - kfree(ahd->saved_stack); + kfree(ahd->name); + kfree(ahd->seep_config); + kfree(ahd->saved_stack); kfree(ahd); return; } -- 2.21.1