From patchwork Mon Jul 16 13:39:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siva Rebbagondla X-Patchwork-Id: 10526807 X-Patchwork-Delegate: kvalo@adurom.com 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 9D0FE600D0 for ; Mon, 16 Jul 2018 13:36:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CAB4287B4 for ; Mon, 16 Jul 2018 13:36:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80765287CB; Mon, 16 Jul 2018 13:36:15 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 212C8287B4 for ; Mon, 16 Jul 2018 13:36:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727866AbeGPODm (ORCPT ); Mon, 16 Jul 2018 10:03:42 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35912 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727313AbeGPODm (ORCPT ); Mon, 16 Jul 2018 10:03:42 -0400 Received: by mail-pf0-f195.google.com with SMTP id d14-v6so2539808pfo.3 for ; Mon, 16 Jul 2018 06:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vGuA5MFAgQBza/A0vJ0PrWDbAyN19VNzStT8e1rvoic=; b=FQLF4iklpyQYQpX/+HfIer1sIZ0mVMOykXyB0vQedmqtnMM+oZpnHaNba+Z/itIydf tgXQw58r6qCy6PLuJSFkXpcRLrJDYoEDdhJaUGgkAcBebUGVkq4sMFFbPngcjS6Auauu a0Nyk9vj8kKy5Y+j/nkYQ0321EhRF9jMBrOloRwPQ4RZuf7R4smnqzDHQCB+QduWykJc ZtimmhSC+h7n+yCbsdZPJ8GvGXmafyh6emhsiHnB5HwFd8UhCYwruSKsgLtrdqWj2WvN B4VqYDstlad04hLlJbE8N4T38tsP38PdW22buw43BezHtpnv0dyFDLs/Hr/VUlyuHLEp tqWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vGuA5MFAgQBza/A0vJ0PrWDbAyN19VNzStT8e1rvoic=; b=HP7Ar7PkXOMSGB25OR/X9EBV1D1w/Qmy54l6uIztODB7AVYsBu4pL24GMA/XczlHtd b6eSQobQbIoRAxovbuVtP6DfH8RroUgMmAE42S9lDQLsBQRnOl3lHdMLlebb/8YW4eyV vu3ou1QCToC9WcYZ/LfbaO05KlOKHfRfKvmuLIO99ZMNaRoZY8xUfxWSxbmwRy3+hOc7 goUDax/5d5N6Vn3u8gPAq26QKCVanckDFOxLwUIGHPB1XUNC0PXF9DEeQvOnQSm/S5f+ waF18/p0E3Z45ni8kmUqaSL8c/8dP0r5kI/cEuKhjd0vEmY1iufU1xDpO+mfEXqTHtUk 4/Jg== X-Gm-Message-State: AOUpUlFARXSGZctOP164SHtNtgxecNp1moAphRtezbJ9rVMlvDA27DGN vA7YR1oKQYwHk3psqMF8joI= X-Google-Smtp-Source: AAOMgpdZiaC89bDYT/j0xlXfjHhoPVx0+cywi8Ibf5aCsT9eDS/7IyMyr5MKMN5JD+A+embiUi5mCg== X-Received: by 2002:a62:e30c:: with SMTP id g12-v6mr18217050pfh.25.1531748173123; Mon, 16 Jul 2018 06:36:13 -0700 (PDT) Received: from cpu459.localdomain ([27.59.226.48]) by smtp.gmail.com with ESMTPSA id t3-v6sm53756167pfk.161.2018.07.16.06.36.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jul 2018 06:36:12 -0700 (PDT) From: Siva Rebbagondla To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Sushant Kumar Mishra , Siva Rebbagondla , Amol Hanwate Subject: [PATCH 2/6] rsi: remove redundant flash_content variable Date: Mon, 16 Jul 2018 19:09:33 +0530 Message-Id: <1531748377-29215-3-git-send-email-siva8118@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1531748377-29215-1-git-send-email-siva8118@gmail.com> References: <1531748377-29215-1-git-send-email-siva8118@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Siva Rebbagondla while cleaning up the driver, observed that flash_content pointer is not necessary in rsi_load_firmware(). Instead of this, driver can use 'fw_entry->data' directly.Hence, removed redundant flash_content pointer. Signed-off-by: Siva Rebbagondla --- drivers/net/wireless/rsi/rsi_91x_hal.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c index 533d9e9..150c3e6 100644 --- a/drivers/net/wireless/rsi/rsi_91x_hal.c +++ b/drivers/net/wireless/rsi/rsi_91x_hal.c @@ -842,7 +842,6 @@ static int rsi_load_firmware(struct rsi_hw *adapter) const struct firmware *fw_entry = NULL; u32 regout_val = 0, content_size; u16 tmp_regout_val = 0; - u8 *flash_content = NULL; struct ta_metadata *metadata_p; int status; @@ -904,28 +903,22 @@ static int rsi_load_firmware(struct rsi_hw *adapter) __func__, metadata_p->name); return status; } - flash_content = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); - if (!flash_content) { - rsi_dbg(ERR_ZONE, "%s: Failed to copy firmware\n", __func__); - status = -EIO; - goto fail; - } content_size = fw_entry->size; rsi_dbg(INFO_ZONE, "FW Length = %d bytes\n", content_size); /* Get the firmware version */ common->lmac_ver.ver.info.fw_ver[0] = - flash_content[LMAC_VER_OFFSET] & 0xFF; + fw_entry->data[LMAC_VER_OFFSET] & 0xFF; common->lmac_ver.ver.info.fw_ver[1] = - flash_content[LMAC_VER_OFFSET + 1] & 0xFF; - common->lmac_ver.major = flash_content[LMAC_VER_OFFSET + 2] & 0xFF; + fw_entry->data[LMAC_VER_OFFSET + 1] & 0xFF; + common->lmac_ver.major = fw_entry->data[LMAC_VER_OFFSET + 2] & 0xFF; common->lmac_ver.release_num = - flash_content[LMAC_VER_OFFSET + 3] & 0xFF; - common->lmac_ver.minor = flash_content[LMAC_VER_OFFSET + 4] & 0xFF; + fw_entry->data[LMAC_VER_OFFSET + 3] & 0xFF; + common->lmac_ver.minor = fw_entry->data[LMAC_VER_OFFSET + 4] & 0xFF; common->lmac_ver.patch_num = 0; rsi_print_version(common); - status = bl_write_header(adapter, flash_content, content_size); + status = bl_write_header(adapter, (u8 *)fw_entry->data, content_size); if (status) { rsi_dbg(ERR_ZONE, "%s: RPS Image header loading failed\n", @@ -967,7 +960,7 @@ static int rsi_load_firmware(struct rsi_hw *adapter) rsi_dbg(INFO_ZONE, "Burn Command Pass.. Upgrading the firmware\n"); - status = auto_fw_upgrade(adapter, flash_content, content_size); + status = auto_fw_upgrade(adapter, (u8 *)fw_entry->data, content_size); if (status == 0) { rsi_dbg(ERR_ZONE, "Firmware upgradation Done\n"); goto load_image_cmd; @@ -981,13 +974,11 @@ static int rsi_load_firmware(struct rsi_hw *adapter) success: rsi_dbg(ERR_ZONE, "***** Firmware Loading successful *****\n"); - kfree(flash_content); release_firmware(fw_entry); return 0; fail: rsi_dbg(ERR_ZONE, "##### Firmware loading failed #####\n"); - kfree(flash_content); release_firmware(fw_entry); return status; }