wcn36xx: Fold indication payload into message header
authorBjorn Andersson <bjorn.andersson@sonymobile.com>
Mon, 20 Jun 2016 06:19:43 +0000 (23:19 -0700)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 8 Jul 2016 13:58:14 +0000 (16:58 +0300)
Merge the two allocation instead of separately allocating room for the
indication payload.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/wcn36xx/smd.c
drivers/net/wireless/ath/wcn36xx/smd.h

index e8b630c4f11ef0cd2536eabf95b8e2994b7e890a..1a9580d72077e5a6b5fb12c560f4f696cb16803b 100644 (file)
@@ -2229,14 +2229,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.
@@ -2245,6 +2239,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);
@@ -2295,7 +2293,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);
 }
index d93e3fd73831c98b67ddf32c1cf436d32a34d20e..c4375ce1019a1dab666f050dcfc0928085128627 100644 (file)
@@ -46,8 +46,8 @@ struct wcn36xx_fw_msg_status_rsp {
 
 struct wcn36xx_hal_ind_msg {
        struct list_head list;
-       u8 *msg;
        size_t msg_len;
+       u8 msg[];
 };
 
 struct wcn36xx;