Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6242044imu; Sun, 2 Dec 2018 13:17:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/XrwNyU/GUI+Bxdpg3j0PfRjsVHmsuk4CFn1PCN1ZeRQMvH0U+Tw0ZFeTtTc6vVyh6Lbag1 X-Received: by 2002:a62:a510:: with SMTP id v16mr13407616pfm.18.1543785474296; Sun, 02 Dec 2018 13:17:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543785474; cv=none; d=google.com; s=arc-20160816; b=TdqvPXj7cOBtWSD09hyrAnwjK8Gy4B45C4zwdolJsFTrd19S4xPfF42DbsV5myYLhu ZFGuWve6vvMdYYmTEKUFQAaga39r/1DZ6wW9+Cfk8zhoOScdheiBZi9oNz6GdSa52smM CDkCbLsmEQPwTKlW++hzzqxQYkcp0TdLPc8/Zkcfaq7O5S8JNSbq2CsomcXMOQsv6CF1 M6v4ilslZsvKSgMvmvR0R2RPvQY2IV0MNOm0TYNK3MdVJqNQDLM+Ld8fDc/iXK6tiHHf zGa/iJanVzk7eihDN3BrETUA4IgSTQ4WpxiSDkQRMkBoB2YxY1tl06waTpkjC1gM2wRS vVLg== 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:user-agent:date :in-reply-to:references:message-id:mime-version:to:from:subject; bh=mW9aDcNrhLZGyGpmXFhlLAE4NbE9LASibsiN82QzamI=; b=U6qaZoA5UK8UC4mgXCnNI06L0cgLk51hcZU3xkffv9JsqZMV3MDbMOkcCVSspzBlMp SpvWCfkCSaN3LrM1qdQDlSsmSSi4L1I830wKbDrrNwqO0bcYJyi+uK6E800FEeGnBuJc k1r6pu8/41+CmT5SaboCit52gPL11lb1sQ2pxe5V+CKz6AFKegcRFP3lb5f4F0uwoDDW 5dAVz9MViafeFBl4x6iymT4XzGrBANJqbKK6zxr4ZsFZZ3d7WcM6dL2cBtA+0Gbwedaw 4mJFtLfgM3gtMnxFB+B4OTOylMlXRHJJk6u/3SxMlZ97R1j29nfjaLZKNkLutKyo/st3 TIKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f22si10667487pgm.81.2018.12.02.13.17.40; Sun, 02 Dec 2018 13:17:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725961AbeLBVPy (ORCPT + 99 others); Sun, 2 Dec 2018 16:15:54 -0500 Received: from www17.your-server.de ([213.133.104.17]:57650 "EHLO www17.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725779AbeLBVPw (ORCPT ); Sun, 2 Dec 2018 16:15:52 -0500 Received: from [78.46.172.3] (helo=sslproxy06.your-server.de) by www17.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1gTYlo-00015t-RM; Sun, 02 Dec 2018 21:55:16 +0100 Received: from [2a02:908:4c28:3f60:fff6:43c5:695c:41d6] (helo=localhost.localdomain) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1gTYlo-0002bU-Lj; Sun, 02 Dec 2018 21:55:16 +0100 Subject: [PATCH] scsi: aic7xxx: NULL check before some freeing functions is not needed. From: Thomas Meyer To: hare@suse.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 X-Patch: Cocci X-Mailer: DiffSplit Message-ID: <1543760930051-396326998-6-diffsplit-thomas@m3y3r.de> References: <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de> In-Reply-To: <1543760930050-1499171309-0-diffsplit-thomas@m3y3r.de> X-Serial-No: 6 Date: Sun, 02 Dec 2018 21:52:11 +0100 User-Agent: Evolution 3.30.2 (3.30.2-2.fc29) Content-Transfer-Encoding: 7bit X-Authenticated-Sender: thomas@m3y3r.de X-Virus-Scanned: Clear (ClamAV 0.100.2/25173/Sun Dec 2 15:13:44 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NULL check before some freeing functions is not needed. Signed-off-by: Thomas Meyer --- diff -u -p a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -3673,8 +3673,7 @@ ahd_free_tstate(struct ahd_softc *ahd, u return; tstate = ahd->enabled_targets[scsi_id]; - if (tstate != NULL) - kfree(tstate); + kfree(tstate); ahd->enabled_targets[scsi_id] = NULL; } #endif @@ -6136,8 +6135,7 @@ ahd_set_unit(struct ahd_softc *ahd, int void ahd_set_name(struct ahd_softc *ahd, char *name) { - if (ahd->name != NULL) - kfree(ahd->name); + kfree(ahd->name); ahd->name = name; } @@ -6198,12 +6196,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); #ifndef __FreeBSD__ kfree(ahd); #endif diff -u -p a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c @@ -2193,8 +2193,7 @@ ahc_free_tstate(struct ahc_softc *ahc, u 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 @@ -4474,8 +4473,7 @@ ahc_set_unit(struct ahc_softc *ahc, int void ahc_set_name(struct ahc_softc *ahc, char *name) { - if (ahc->name != NULL) - kfree(ahc->name); + kfree(ahc->name); ahc->name = name; } @@ -4536,10 +4534,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); #ifndef __FreeBSD__ kfree(ahc); #endif @@ -4944,8 +4940,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