From patchwork Wed Oct 4 23:28:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 9985985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B28A6028E for ; Wed, 4 Oct 2017 23:52:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5F9A285B9 for ; Wed, 4 Oct 2017 23:52:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAAF428C2B; Wed, 4 Oct 2017 23:52:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1ABCA285B9 for ; Wed, 4 Oct 2017 23:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751226AbdJDXwq (ORCPT ); Wed, 4 Oct 2017 19:52:46 -0400 Received: from gateway36.websitewelcome.com ([192.185.192.36]:23677 "EHLO gateway36.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201AbdJDXwp (ORCPT ); Wed, 4 Oct 2017 19:52:45 -0400 X-Greylist: delayed 1374 seconds by postgrey-1.27 at vger.kernel.org; Wed, 04 Oct 2017 19:52:45 EDT Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 9DF2A40765B37 for ; Wed, 4 Oct 2017 18:28:11 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id zt4Od9Tpkc72gzt4Ods1dZ; Wed, 04 Oct 2017 18:27:16 -0500 Received: from [189.152.226.223] (port=48406 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.87) (envelope-from ) id 1dzt5H-001ta2-9b; Wed, 04 Oct 2017 18:28:11 -0500 Date: Wed, 4 Oct 2017 18:28:08 -0500 From: "Gustavo A. R. Silva" To: qla2xxx-upstream@qlogic.com, "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] scsi: qla2xxx: remove dead code in qla82xx_write_flash_data Message-ID: <20171004232808.GA31707@embeddedor.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.152.226.223 X-Exim-ID: 1dzt5H-001ta2-9b X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.152.226.223]:48406 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 4 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Local variable page_mode is assigned to a constant value and it is never updated again. Remove this variable and the dead code it guards. Addresses-Coverity-ID: 200420 Addresses-Coverity-ID: 114338 Signed-off-by: Gustavo A. R. Silva --- This code was tested by compilation only. Also, notice that this code has not been updated since 2010. drivers/scsi/qla2xxx/qla_nx.c | 54 ++----------------------------------------- 1 file changed, 2 insertions(+), 52 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index a77c339..d5c3d36 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c @@ -2676,33 +2676,14 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, int ret; uint32_t liter; uint32_t rest_addr; - dma_addr_t optrom_dma; - void *optrom = NULL; - int page_mode = 0; struct qla_hw_data *ha = vha->hw; - ret = -1; - - /* Prepare burst-capable write on supported ISPs. */ - if (page_mode && !(faddr & 0xfff) && - dwords > OPTROM_BURST_DWORDS) { - optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE, - &optrom_dma, GFP_KERNEL); - if (!optrom) { - ql_log(ql_log_warn, vha, 0xb01b, - "Unable to allocate memory " - "for optrom burst write (%x KB).\n", - OPTROM_BURST_SIZE / 1024); - } - } - rest_addr = ha->fdt_block_size - 1; - ret = qla82xx_unprotect_flash(ha); if (ret) { ql_log(ql_log_warn, vha, 0xb01c, "Unable to unprotect flash for update.\n"); - goto write_done; + return ret; } for (liter = 0; liter < dwords; liter++, faddr += 4, dwptr++) { @@ -2718,34 +2699,6 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, } } - /* Go with burst-write. */ - if (optrom && (liter + OPTROM_BURST_DWORDS) <= dwords) { - /* Copy data to DMA'ble buffer. */ - memcpy(optrom, dwptr, OPTROM_BURST_SIZE); - - ret = qla2x00_load_ram(vha, optrom_dma, - (ha->flash_data_off | faddr), - OPTROM_BURST_DWORDS); - if (ret != QLA_SUCCESS) { - ql_log(ql_log_warn, vha, 0xb01e, - "Unable to burst-write optrom segment " - "(%x/%x/%llx).\n", ret, - (ha->flash_data_off | faddr), - (unsigned long long)optrom_dma); - ql_log(ql_log_warn, vha, 0xb01f, - "Reverting to slow-write.\n"); - - dma_free_coherent(&ha->pdev->dev, - OPTROM_BURST_SIZE, optrom, optrom_dma); - optrom = NULL; - } else { - liter += OPTROM_BURST_DWORDS - 1; - faddr += OPTROM_BURST_DWORDS - 1; - dwptr += OPTROM_BURST_DWORDS - 1; - continue; - } - } - ret = qla82xx_write_flash_dword(ha, faddr, cpu_to_le32(*dwptr)); if (ret) { @@ -2760,10 +2713,7 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, if (ret) ql_log(ql_log_warn, vha, 0xb021, "Unable to protect flash after update.\n"); -write_done: - if (optrom) - dma_free_coherent(&ha->pdev->dev, - OPTROM_BURST_SIZE, optrom, optrom_dma); + return ret; }