Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp891855pxb; Fri, 22 Jan 2021 01:39:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUorlVzAGVZLEFfVON8/u1tK2OJmFY7LswagyIeAzczAhYLiT931XJKQHcDU7UA3yr6mZM X-Received: by 2002:a17:906:bce3:: with SMTP id op3mr2399031ejb.485.1611308397257; Fri, 22 Jan 2021 01:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611308397; cv=none; d=google.com; s=arc-20160816; b=g+oQcpIEJ5LvjYsZQd3T8k7JFxVmBA6w88xdn9ABK1rXAGKkSEdUfH5yw4UkXsnugU Q/vRXQYRvhm2/abIb6VFaAH/f5Eq+/j1I2gHuZOmUi+YwQeznnAmodKwGnasw8R2/M5Y HJV6+DtH8fbgz53dsAtFYPqMNQsQXnKF92Mv9AdfD9p4tsnWzZS+DuRc9X8jh3E0tUcY jg05kAyckvuMsmhWKswKpy4zV/CB/iXOiteNxkVnD11+dT6NktXC9bPJrHC0QOJCIf1b M3lZ12EvBoReCSB3cG/iIruPbKiBP6t+h8jTgWZPg2BLrJCNuswYeUsOjoOI2VSqaczA uYwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=RLnYshErR72xXP6/aF3ak40OCYLmHy+EK5kX8LBw6Tk=; b=sRO9TNvv0w9wWhiUpw7EdKEBaKe9dTBk4HBCsWcvj4Ri65tPgYbeGdrWNf8QfshVj4 sVYrUonyDOIu7w40D3y4ogeW7Iqw9Z8AuKcfRX3ycv+S8cYF6lyCJvQ6aqf671jo3URG sHx1Zjgh+OpQHd9xFdmSnzR0CsBvDgp7moMoS4Fa7TdavcDSbpO+1/Hf1xTxqNXHf0C0 1SuiC+Y+/VwVO/NvKQ25/fHAwrtS81wBnT2u3fmJlPfDdy2qEAdJzvEhcY9/BArWFfiU iam64ocEFJ/NUjrzOLUv9dUUPCB+XaDEteVPiaRkbtkmKOxWRnCHfkV90NEbkZbVLLqp XXQQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z23si2307577eja.0.2021.01.22.01.39.33; Fri, 22 Jan 2021 01:39:57 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727420AbhAVJhy (ORCPT + 99 others); Fri, 22 Jan 2021 04:37:54 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:59723 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727336AbhAVJQC (ORCPT ); Fri, 22 Jan 2021 04:16:02 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R661e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=abaci-bugfix@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UMW.J7l_1611306175; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:abaci-bugfix@linux.alibaba.com fp:SMTPD_---0UMW.J7l_1611306175) by smtp.aliyun-inc.com(127.0.0.1); Fri, 22 Jan 2021 17:03:20 +0800 From: Yang Li To: martin.petersen@oracle.c Cc: martin.petersen@oracle.com, njavali@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, mrangankar@marvell.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li Subject: [PATCH 1/2] scsi: qla2xxx: remove redundant NULL check Date: Fri, 22 Jan 2021 17:02:53 +0800 Message-Id: <1611306174-92627-1-git-send-email-abaci-bugfix@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix below warnings reported by coccicheck: ./drivers/scsi/qla2xxx/qla_init.c:3371:2-7: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/qla2xxx/qla_init.c:7855:5-10: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/qla2xxx/qla_init.c:7916:2-7: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/qla2xxx/qla_init.c:8113:4-18: WARNING: NULL check before some freeing functions is not needed. ./drivers/scsi/qla2xxx/qla_init.c:8174:2-7: WARNING: NULL check before some freeing functions is not needed. Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/scsi/qla2xxx/qla_init.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index dcc0f0d8..edd5dd1 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3371,8 +3371,7 @@ static void qla2x00_tmf_sp_done(srb_t *sp, int res) "Re-Allocated (%d KB) and save firmware dump.\n", dump_size / 1024); } else { - if (ha->fw_dump) - vfree(ha->fw_dump); + vfree(ha->fw_dump); ha->fw_dump = fw_dump; ha->fw_dump_len = ha->fw_dump_alloc_len = @@ -7855,8 +7854,7 @@ bool qla24xx_risc_firmware_invalid(uint32_t *dword) templates = (risc_attr & BIT_9) ? 2 : 1; ql_dbg(ql_dbg_init, vha, 0x0160, "-> templates = %u\n", templates); for (j = 0; j < templates; j++, fwdt++) { - if (fwdt->template) - vfree(fwdt->template); + vfree(fwdt->template); fwdt->template = NULL; fwdt->length = 0; @@ -7916,8 +7914,7 @@ bool qla24xx_risc_firmware_invalid(uint32_t *dword) return QLA_SUCCESS; failed: - if (fwdt->template) - vfree(fwdt->template); + vfree(fwdt->template); fwdt->template = NULL; fwdt->length = 0; @@ -8113,8 +8110,7 @@ bool qla24xx_risc_firmware_invalid(uint32_t *dword) templates = (risc_attr & BIT_9) ? 2 : 1; ql_dbg(ql_dbg_init, vha, 0x0170, "-> templates = %u\n", templates); for (j = 0; j < templates; j++, fwdt++) { - if (fwdt->template) - vfree(fwdt->template); + vfree(fwdt->template); fwdt->template = NULL; fwdt->length = 0; @@ -8174,8 +8170,7 @@ bool qla24xx_risc_firmware_invalid(uint32_t *dword) return QLA_SUCCESS; failed: - if (fwdt->template) - vfree(fwdt->template); + vfree(fwdt->template); fwdt->template = NULL; fwdt->length = 0; -- 1.8.3.1