Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1513553ybz; Sat, 18 Apr 2020 02:35:19 -0700 (PDT) X-Google-Smtp-Source: APiQypIhuvHAmCelRfI0gZAzNpEyfrxgExUuZcVuytBU47fzmkiLq1Jliio2RgkzIoVtrFPb4C/T X-Received: by 2002:a05:6402:290:: with SMTP id l16mr6118735edv.207.1587202519794; Sat, 18 Apr 2020 02:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587202519; cv=none; d=google.com; s=arc-20160816; b=is7oHQ0C04/5ZsLc6u8zLPzleffp/B1wtxFlHKEpsdCMdKAgb2qUQlaxFuuIL+izy2 EuINLB5gfIUC/lQG+xc7tmBeBdCAc0986i8Z9Op8K0RKbFWRqr54OPGdEYrKYhUNTfGA +ZLOaCViAwu1zBuvu0k0NUALuSiAcN1lvUDLA3doY0UyZSw7WfPNaoG5W6tZAfAs1AlN ErBIhJ3W6l383kxOcB/GJsag+C64vH7PdR4KlG+ftdFRcBVDJKAzn2SEZdRFWUkc6Z1v 8pBxpCWqv9dxBm7AKlR2vTimoEExGnH5g+O3O6I/JYP7TS9wzqOkUzDylGwH0vuluzr+ ubeA== 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=gAqWbZ3F7Rkd7w8ZThFg1xni7RicR1u1kwYfomnqBIQ=; b=JDd/wuPv0+tq1jJ7u0Mp0uhichslQauPfhvmEDqwsQTZQiOeYVSzcc8jbfLrI8V51Z wH22k1x1hPnwCotghgFYpxA0hA3zOa3IM/8Z6I5WDRxhT7ovDNGCUFbacBUo9juq36S+ jB06k9gQnef0gbTednvq0Mf0OgCVg/3Q9m6XpIIop4puYTjzGeol7TC9GhEbbADkhk+m dqEX+OktIk1aSqZOC2DOj/+9rrSJPKCHd0Irai8aCMNZYvAU1OCti6bGRiJpRlVkla0t 16ekmdpi0HOVCOFD/JEojoJj9cuiaWn7xs4Bs9uMGOsfYh4G9ajQ1HdBwuhclIdGuH8f KSeg== 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 s7si15236525ejj.248.2020.04.18.02.34.57; Sat, 18 Apr 2020 02:35:19 -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 S1726036AbgDRJdL (ORCPT + 99 others); Sat, 18 Apr 2020 05:33:11 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2797 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725857AbgDRJdK (ORCPT ); Sat, 18 Apr 2020 05:33:10 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4B982CC0B6FFC8E55697; Sat, 18 Apr 2020 17:33:09 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Sat, 18 Apr 2020 17:33:01 +0800 From: Jason Yan To: , , , , , , CC: Hulk Robot Subject: [PATCH] scsi: aic7xxx: remove NULL check before some freeing functions Date: Sat, 18 Apr 2020 17:59:27 +0800 Message-ID: <20200418095927.35460-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/aic7xxx_core.c:4931:2-7: WARNING: NULL check before some freeing functions is not needed. drivers/scsi/aic7xxx/aic7xxx_core.c:4519:2-7: WARNING: NULL check before some freeing functions is not needed. drivers/scsi/aic7xxx/aic7xxx_core.c:4521:2-7: WARNING: NULL check before some freeing functions is not needed. drivers/scsi/aic7xxx/aic7xxx_core.c:2182:2-7: WARNING: NULL check before some freeing functions is not needed. drivers/scsi/aic7xxx/aic7xxx_core.c:4457:2-7: WARNING: NULL check before some freeing functions is not needed. Reported-by: Hulk Robot Signed-off-by: Jason Yan --- drivers/scsi/aic7xxx/aic7xxx_core.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 84fc499cb1e6..5a10feea17fe 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c @@ -2178,8 +2178,7 @@ ahc_free_tstate(struct ahc_softc *ahc, u_int scsi_id, char channel, int force) if (channel == 'B') scsi_id += 8; tstate = ahc->enabled_targets[scsi_id]; - if (tstate != NULL) - kfree(tstate); + kfree(tstate); ahc->enabled_targets[scsi_id] = NULL; } #endif @@ -4453,8 +4452,7 @@ ahc_set_unit(struct ahc_softc *ahc, int unit) void ahc_set_name(struct ahc_softc *ahc, char *name) { - if (ahc->name != NULL) - kfree(ahc->name); + kfree(ahc->name); ahc->name = name; } @@ -4515,10 +4513,8 @@ ahc_free(struct ahc_softc *ahc) kfree(ahc->black_hole); } #endif - if (ahc->name != NULL) - kfree(ahc->name); - if (ahc->seep_config != NULL) - kfree(ahc->seep_config); + kfree(ahc->name); + kfree(ahc->seep_config); kfree(ahc); return; } @@ -4927,8 +4923,7 @@ ahc_fini_scbdata(struct ahc_softc *ahc) case 0: break; } - if (scb_data->scbarray != NULL) - kfree(scb_data->scbarray); + kfree(scb_data->scbarray); } static void -- 2.21.1