From patchwork Thu Jun 27 06:28:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1123144 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Z93p5DvNz9sLt; Thu, 27 Jun 2019 16:29:42 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hgNuc-0007g9-Nw; Thu, 27 Jun 2019 06:29:38 +0000 Received: from mail-pf1-f195.google.com ([209.85.210.195]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1hgNua-0007fS-0l for kernel-team@lists.ubuntu.com; Thu, 27 Jun 2019 06:29:36 +0000 Received: by mail-pf1-f195.google.com with SMTP id q10so681267pff.9 for ; Wed, 26 Jun 2019 23:29:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BNEstnfewqcD0hnMWaqPiaWOHbiuJ/DUlSVFON/F4X4=; b=Cc9DSubGuJUE2aNHgrAKGrjbmbqPdP7hQwjfozHSo66JHPlk4GUy8ep351axZl9S0j S8DO7icc6qrX7RChtOyzM0ExqR5RAt4JbJ28IQJc9k75/kYr0KguD15OzzQH2aSr8fbd McTYfNqdcOJzPd33Ei3os4VMrGGvzXtuLk5i1SkbQAwuChWKexeOL/LfvQppEfNxTMC3 ObSiaDLRUgVWe5xKWW5WS6d3mWmP46+t1lzhhzCGAOFZ5X8Ydj5Uv8dJyUoRj/3cpN1V rYirCOlXnfr+lFwAl4I0QxJ+Xz+F0pwD8K0HyAZLNOREFeaRH28jzCe6PV1qAjq773Nf PqhA== X-Gm-Message-State: APjAAAVsJPp8rboaU5DjFGLuTuo25B6pimL6B6i+uQFoo55ZXIuNClxV b7RxP04lKmc73yDBLXhbU2YeURly X-Google-Smtp-Source: APXvYqwb6DqoYH8OT7V0WWmgL8DeSS/EDKrUqCs/kjDuEnz2IrB3twAM9M9R6QlKe9dCm5qMdNodBw== X-Received: by 2002:a17:90a:601:: with SMTP id j1mr3946585pjj.96.1561616974089; Wed, 26 Jun 2019 23:29:34 -0700 (PDT) Received: from momoga.taipei.internal (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id a3sm1512383pfi.63.2019.06.26.23.29.33 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 26 Jun 2019 23:29:33 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2][SRU][OEM-OSP1] iwlwifi: mvm: don't use iwl_geo_tx_power_profiles_cmd_v1 Date: Thu, 27 Jun 2019 14:28:29 +0800 Message-Id: <20190627062829.1988-3-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190627062829.1988-1-vicamo.yang@canonical.com> References: <20190627062829.1988-1-vicamo.yang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Luca Coelho BugLink: https://bugs.launchpad.net/bugs/1834415 We don't need to allocate a new structure and copy the data from the new one into it, because they are the same, except that the new version has one more element at the end. We can simply send the same structure but pass the size of the old one when we send the command. This avoid extra stack allocations and a memcpy in the code. The memcpy() was causing a static analyzer warning because it was not using the size of the destination. type=bugfix ticket=none fixes=I52d2afa9f243765b63da3279496c524c77b26e20 Change-Id: Iaaeba37a842ba6abc9e53c7f018f5362964a6daf Signed-off-by: Luca Coelho Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/222716 Tested-by: ec ger unix iil jenkins x-iwlwifi-stack-dev: 023605ffda133e4cea2fe29c2ec7dbcbe48988c4 (backported from commit 33693c2f3ae9eafcfd69d2c2977dcc8cbaf199fc https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi.git) Signed-off-by: You-Sheng Yang --- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index f66fe897d415f..80bb2f50a730f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -959,21 +959,16 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm) i, j, value[1], value[2], value[0]); } } - if (fw_has_api(&mvm->fw->ucode_capa, - IWL_UCODE_TLV_API_SAR_TABLE_VER)) { - cmd.table_revision = cpu_to_le32(mvm->geo_rev); - } else { - struct iwl_geo_tx_power_profiles_cmd_v1 cmd_v1 = { - .ops = cpu_to_le32(IWL_PER_CHAIN_OFFSET_SET_TABLES), - }; - memcpy(&cmd_v1.table, cmd.table, - sizeof(struct iwl_per_chain_offset_group) * - IWL_NUM_GEO_PROFILES); + cmd.table_revision = cpu_to_le32(mvm->geo_rev); - return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0, sizeof(cmd_v1), - &cmd_v1); + if (!fw_has_api(&mvm->fw->ucode_capa, + IWL_UCODE_TLV_API_SAR_TABLE_VER)) { + return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0, + sizeof(struct iwl_geo_tx_power_profiles_cmd_v1), + &cmd); } + return iwl_mvm_send_cmd_pdu(mvm, cmd_wide_id, 0, sizeof(cmd), &cmd); }