goto out_free_dxe_pool;
        }
 
-       wcn->hal_buf = kmalloc(WCN36XX_HAL_BUF_SIZE, GFP_KERNEL);
-       if (!wcn->hal_buf) {
-               wcn36xx_err("Failed to allocate smd buf\n");
-               ret = -ENOMEM;
-               goto out_free_dxe_ctl;
-       }
-
        ret = wcn36xx_smd_load_nv(wcn);
        if (ret) {
                wcn36xx_err("Failed to push NV to chip\n");
-               goto out_free_smd_buf;
+               goto out_free_dxe_ctl;
        }
 
        ret = wcn36xx_smd_start(wcn);
        if (ret) {
                wcn36xx_err("Failed to start chip\n");
-               goto out_free_smd_buf;
+               goto out_free_dxe_ctl;
        }
 
        if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
 
 out_smd_stop:
        wcn36xx_smd_stop(wcn);
-out_free_smd_buf:
-       kfree(wcn->hal_buf);
 out_free_dxe_ctl:
        wcn36xx_dxe_free_ctl_blks(wcn);
 out_free_dxe_pool:
 
        wcn36xx_dxe_free_mem_pools(wcn);
        wcn36xx_dxe_free_ctl_blks(wcn);
-
-       kfree(wcn->hal_buf);
 }
 
 static void wcn36xx_change_ps(struct wcn36xx *wcn, bool enable)
        mutex_init(&wcn->hal_mutex);
        mutex_init(&wcn->scan_lock);
 
+       wcn->hal_buf = devm_kmalloc(wcn->dev, WCN36XX_HAL_BUF_SIZE, GFP_KERNEL);
+       if (!wcn->hal_buf) {
+               ret = -ENOMEM;
+               goto out_wq;
+       }
+
        ret = dma_set_mask_and_coherent(wcn->dev, DMA_BIT_MASK(32));
        if (ret < 0) {
                wcn36xx_err("failed to set DMA mask: %d\n", ret);