return -EFAULT;
}
- hw = (struct vdec_avs_hw_s *)devm_kzalloc(&pdev->dev,
- sizeof(struct vdec_avs_hw_s), GFP_KERNEL);
+ hw = (struct vdec_avs_hw_s *)vzalloc(sizeof(struct vdec_avs_hw_s));
if (hw == NULL) {
pr_info("\nammvdec_avs decoder driver alloc failed\n");
return -ENOMEM;
#endif
kfree(hw->gvs);
hw->gvs = NULL;
-
+ vfree(hw);
return 0;
}
{
struct vdec_s *pdata = *(struct vdec_s **)pdev->dev.platform_data;
struct vdec_avs_hw_s *hw = NULL;
+ int r = 0;
if (vdec_get_debug_flags() & 0x8)
return amvdec_avs_probe(pdev);
return -EFAULT;
}
- hw = (struct vdec_avs_hw_s *)devm_kzalloc(&pdev->dev,
- sizeof(struct vdec_avs_hw_s), GFP_KERNEL);
+ hw = (struct vdec_avs_hw_s *)vzalloc(sizeof(struct vdec_avs_hw_s));
if (hw == NULL) {
pr_info("\nammvdec_avs decoder driver alloc failed\n");
return -ENOMEM;
canvas_num = 3;
} else {
pr_info("Error, do not support longcabac work around!!!");
- return -ENOMEM;
+ r = -ENOMEM;
+ goto error1;
}
if (pdata->sys_info)
if (!hw->user_data_buffer) {
pr_info("%s: Can not allocate hw->user_data_buffer\n",
__func__);
- return -ENOMEM;
+ r = -ENOMEM;
+ goto error2;
}
pr_debug("hw->user_data_buffer = 0x%p, hw->user_data_buffer_phys = 0x%x\n",
hw->user_data_buffer, (u32)hw->user_data_buffer_phys);
LMEM_BUF_SIZE, (dma_addr_t *)&hw->lmem_phy_addr, GFP_KERNEL);
if (hw->lmem_addr == 0) {
pr_err("%s: failed to alloc lmem buffer\n", __func__);
- return -1;
+ r = -1;
+ goto error3;
}
if (vavs_init(hw) < 0) {
pr_info("amvdec_avs init failed.\n");
- kfree(hw->gvs);
- hw->gvs = NULL;
- pdata->dec_status = NULL;
- return -ENODEV;
+ r = -ENODEV;
+ goto error4;
}
/*INIT_WORK(&hw->fatal_error_wd_work, vavs_fatal_error_handler);
/*INIT_WORK(&hw->userdata_push_work, userdata_push_do_work);*/
-
return 0;
+
+error4:
+ dma_free_coherent(amports_get_dma_device(),
+ LMEM_BUF_SIZE, (void *)hw->lmem_addr,
+ hw->lmem_phy_addr);
+error3:
+ dma_free_coherent(
+ amports_get_dma_device(),
+ USER_DATA_SIZE,
+ hw->user_data_buffer,
+ hw->user_data_buffer_phys);
+error2:
+ kfree(hw->gvs);
+ hw->gvs = NULL;
+ pdata->dec_status = NULL;
+error1:
+ vfree(hw);
+ return r;
}
int ammvdec_avs_remove(struct platform_device *pdev)
hw->gvs = NULL;
}
+ vfree(hw);
return 0;
}
}
}
pr_info("%s %d\n", __func__, __LINE__);
- hw = (struct vdec_avs_hw_s *)devm_kzalloc(&pdev->dev,
- sizeof(struct vdec_avs_hw_s), GFP_KERNEL);
+ hw = (struct vdec_avs_hw_s *)vzalloc(sizeof(struct vdec_avs_hw_s));
if (hw == NULL) {
pr_info("\nammvdec_avs decoder driver alloc failed\n");
return -ENOMEM;
#endif
kfree(hw->gvs);
hw->gvs = NULL;
-
+ vfree(hw);
return 0;
}
#endif