diff --git a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c index eb5c07bc73d063..b022e3621fce6a 100644 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c @@ -77,6 +77,12 @@ enum bcm2835_codec_role { ISP, }; +const static char *roles[] = { + "decode", + "encode", + "isp" +}; + static const char * const components[] = { "ril.video_decode", "ril.video_encode", @@ -2511,7 +2517,6 @@ static int bcm2835_codec_create(struct platform_device *pdev, struct video_device *vfd; int video_nr; int ret; - const static char *roles[] = {"decode", "encode", "isp"}; dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); if (!dev) @@ -2604,7 +2609,8 @@ static int bcm2835_codec_destroy(struct bcm2835_codec_dev *dev) if (!dev) return -ENODEV; - v4l2_info(&dev->v4l2_dev, "Removing " MEM2MEM_NAME); + v4l2_info(&dev->v4l2_dev, "Removing " MEM2MEM_NAME ", %s\n", + roles[dev->role]); v4l2_m2m_release(dev->m2m_dev); video_unregister_device(&dev->vfd); v4l2_device_unregister(&dev->v4l2_dev); diff --git a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c index 4bc738a2abf34a..888040e22d3299 100644 --- a/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c +++ b/drivers/staging/vc04_services/vc-sm-cma/vc_sm.c @@ -656,7 +656,7 @@ static void vc_sm_connected_init(void) __func__, ret); ret = -EIO; - goto err_free_mem; + goto err_failed; } ret = vchi_connect(NULL, 0, vchi_instance); @@ -665,7 +665,7 @@ static void vc_sm_connected_init(void) __func__, ret); ret = -EIO; - goto err_free_mem; + goto err_failed; } /* Initialize an instance of the shared memory service. */ @@ -676,18 +676,11 @@ static void vc_sm_connected_init(void) __func__); ret = -EPERM; - goto err_free_mem; + goto err_failed; } /* Create a debug fs directory entry (root). */ sm_state->dir_root = debugfs_create_dir(VC_SM_DIR_ROOT_NAME, NULL); - if (!sm_state->dir_root) { - pr_err("[%s]: failed to create \'%s\' directory entry\n", - __func__, VC_SM_DIR_ROOT_NAME); - - ret = -EPERM; - goto err_stop_sm_service; - } sm_state->dir_state.show = &vc_sm_cma_global_state_show; sm_state->dir_state.dir_entry = @@ -720,10 +713,8 @@ static void vc_sm_connected_init(void) err_remove_shared_memory: debugfs_remove_recursive(sm_state->dir_root); -err_stop_sm_service: vc_sm_cma_vchi_stop(&sm_state->sm_handle); -err_free_mem: - kfree(sm_state); +err_failed: pr_info("[%s]: failed, ret %d\n", __func__, ret); } @@ -732,7 +723,7 @@ static int bcm2835_vc_sm_cma_probe(struct platform_device *pdev) { pr_info("%s: Videocore shared memory driver\n", __func__); - sm_state = kzalloc(sizeof(*sm_state), GFP_KERNEL); + sm_state = devm_kzalloc(&pdev->dev, sizeof(*sm_state), GFP_KERNEL); if (!sm_state) return -ENOMEM; sm_state->pdev = pdev; @@ -757,16 +748,17 @@ static int bcm2835_vc_sm_cma_remove(struct platform_device *pdev) pr_debug("[%s]: start\n", __func__); if (sm_inited) { /* Remove all proc entries. */ - //debugfs_remove_recursive(sm_state->dir_root); + debugfs_remove_recursive(sm_state->dir_root); /* Stop the videocore shared memory service. */ vc_sm_cma_vchi_stop(&sm_state->sm_handle); + } + if (sm_state) { idr_destroy(&sm_state->kernelid_map); /* Free the memory for the state structure. */ mutex_destroy(&sm_state->map_lock); - kfree(sm_state); } pr_debug("[%s]: end\n", __func__);