From patchwork Mon Dec 28 01:34:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 7924511 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 60F00BEEE5 for ; Mon, 28 Dec 2015 01:36:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91EFF20253 for ; Mon, 28 Dec 2015 01:36:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB25320251 for ; Mon, 28 Dec 2015 01:36:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751728AbbL1Bf0 (ORCPT ); Sun, 27 Dec 2015 20:35:26 -0500 Received: from mail-pf0-f173.google.com ([209.85.192.173]:36689 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751171AbbL1Beg (ORCPT ); Sun, 27 Dec 2015 20:34:36 -0500 Received: by mail-pf0-f173.google.com with SMTP id 65so60765952pff.3 for ; Sun, 27 Dec 2015 17:34:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kryo-se.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5LUsl1zapElwuRSdpgyHT1vomJnfb5/ltfaq8SMDdVQ=; b=rN/37U0/bHXFDeizh+N0IC4wEuqhAPqlCKveVaEtsHx48njnrTpIMqG5IHZd6a3l3h mojTJ/05fao7C37adAnHG3gnZ95VDElHcIATeJDPoIIMS9Q+yG95qay0Wij3Pge2lgyI VeWH/5W+ufkTyfv+gAosq3soPeIVZzA99AEznpi3NnjhQgXc5ukY9/ull0+fSmI3u4c2 nik/gLwy18uwRR28gKOxqv258rTNWfCff67b6g4C+p1hr8izZ7jH3iwVJAUhvQDArQMB yaNOJ0/78WIF1oCfbjgVNIMtcmNcY+Zkj53i5IEI74r/qwULQSu2immKi+xfIbysXsEC 3l9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5LUsl1zapElwuRSdpgyHT1vomJnfb5/ltfaq8SMDdVQ=; b=hr3dOWl0TF9lslNRd4t5oMlT9iN2J4+5iLhmTx98RtRWp0cw2GcNca2WIBbqhjWmxq Zb5xQopP53AkMp3C8b03nN2czC1Pz5C74kXkyaqDGy1KTzNK5nT3umKECBzpzZLNlqbP c5L8LcS28hpSiBh/YwDNp+0cXUA+9J35gWOEWmcwySfZg3bMZVbIRAWz2sNAEmkNLl+J V9B2mpE7E2zg9qzt6S6v6W7i2mbdbE2rO+n73O83ZdjADeXt/S+O8UeodRn7BkVIMCgf Hc9q4gEe0wYRyg7yCCEAPAaispZ+Vsw44qjSKq3vA2Kff0K/zoey6zIYnLT21H56VzXH 66eg== X-Gm-Message-State: ALoCoQkBlDR16mcSZva2zWRLfLqSGhM9XH4Eg4Ww/k0RKr/b++anYJBiDRHfbIjJruFyuPHCOHxTm+arHQchPyCe10pfk9IEug== X-Received: by 10.98.32.201 with SMTP id m70mr46835188pfj.59.1451266475980; Sun, 27 Dec 2015 17:34:35 -0800 (PST) Received: from tuxbot.san.rr.com (cpe-76-167-68-231.natsow.res.rr.com. [76.167.68.231]) by smtp.gmail.com with ESMTPSA id p80sm47600850pfi.12.2015.12.27.17.34.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Dec 2015 17:34:34 -0800 (PST) From: Bjorn Andersson X-Google-Original-From: Bjorn Andersson To: Eugene Krasnikov , Kalle Valo Cc: fengwei.yin@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, wcn36xx@lists.infradead.org Subject: [PATCH 1/4] wcn36xx: Fold indication payload into message header Date: Sun, 27 Dec 2015 17:34:24 -0800 Message-Id: <1451266467-15377-2-git-send-email-bjorn.andersson@sonymobile.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1451266467-15377-1-git-send-email-bjorn.andersson@sonymobile.com> References: <1451266467-15377-1-git-send-email-bjorn.andersson@sonymobile.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Merge the two allocation instead of separately allocating room for the indication payload. Signed-off-by: Bjorn Andersson --- drivers/net/wireless/ath/wcn36xx/smd.c | 15 ++++++--------- drivers/net/wireless/ath/wcn36xx/smd.h | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 74f56a81ad9a..6b5dbe6f0d0a 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2151,14 +2151,8 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len) case WCN36XX_HAL_OTA_TX_COMPL_IND: case WCN36XX_HAL_MISSED_BEACON_IND: case WCN36XX_HAL_DELETE_STA_CONTEXT_IND: - msg_ind = kmalloc(sizeof(*msg_ind), GFP_KERNEL); - if (!msg_ind) - goto nomem; - msg_ind->msg_len = len; - msg_ind->msg = kmemdup(buf, len, GFP_KERNEL); - if (!msg_ind->msg) { - kfree(msg_ind); -nomem: + msg_ind = kmalloc(sizeof(*msg_ind) + len, GFP_KERNEL); + if (!msg_ind) { /* * FIXME: Do something smarter then just * printing an error. @@ -2167,6 +2161,10 @@ nomem: msg_header->msg_type); break; } + + msg_ind->msg_len = len; + memcpy(msg_ind->msg, buf, len); + mutex_lock(&wcn->hal_ind_mutex); list_add_tail(&msg_ind->list, &wcn->hal_ind_queue); queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work); @@ -2217,7 +2215,6 @@ static void wcn36xx_ind_smd_work(struct work_struct *work) msg_header->msg_type); } list_del(wcn->hal_ind_queue.next); - kfree(hal_ind_msg->msg); kfree(hal_ind_msg); mutex_unlock(&wcn->hal_ind_mutex); } diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 8361f9e3995b..21cc4ac7b5ca 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -55,8 +55,8 @@ struct wcn36xx_fw_msg_status_rsp_v2 { struct wcn36xx_hal_ind_msg { struct list_head list; - u8 *msg; size_t msg_len; + u8 msg[]; }; struct wcn36xx;