msm: vidc: Guard debugfs

Shut the fuck up please
This commit is contained in:
EmanuelCN 2022-07-23 14:58:02 +02:00 committed by spakkkk
parent 4ad9b3f99d
commit e129674a12
2 changed files with 14 additions and 8 deletions

View File

@ -11,8 +11,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#endif
#include <linux/dma-mapping.h>
#include <linux/init.h>
#include <linux/ioctl.h>
@ -612,10 +613,10 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev)
mutex_lock(&vidc_driver->lock);
list_add_tail(&core->list, &vidc_driver->cores);
mutex_unlock(&vidc_driver->lock);
#ifdef CONFIG_DEBUG_FS
core->debugfs_root = msm_vidc_debugfs_init_core(
core, vidc_driver->debugfs_root);
#endif
vidc_driver->platform_version =
msm_vidc_read_efuse_version(pdev,
core->resources.pf_ver_tbl, "efuse");
@ -805,27 +806,31 @@ static int __init msm_vidc_init(void)
INIT_LIST_HEAD(&vidc_driver->cores);
mutex_init(&vidc_driver->lock);
#ifdef CONFIG_DEBUG_FS
vidc_driver->debugfs_root = msm_vidc_debugfs_init_drv();
if (!vidc_driver->debugfs_root)
dprintk(VIDC_ERR,
"Failed to create debugfs for msm_vidc\n");
#endif
rc = platform_driver_register(&msm_vidc_driver);
if (rc) {
dprintk(VIDC_ERR,
"Failed to register platform driver\n");
#ifdef CONFIG_DEBUG_FS
debugfs_remove_recursive(vidc_driver->debugfs_root);
#endif
kfree(vidc_driver);
vidc_driver = NULL;
}
return rc;
}
static void __exit msm_vidc_exit(void)
{
platform_driver_unregister(&msm_vidc_driver);
#ifdef CONFIG_DEBUG_FS
debugfs_remove_recursive(vidc_driver->debugfs_root);
#endif
kfree(vidc_driver);
vidc_driver = NULL;
}

View File

@ -1334,10 +1334,10 @@ void *msm_vidc_open(int core_id, int session_type)
"Instance count reached Max limit, rejecting session");
goto fail_init;
}
#ifdef CONFIG_DEBUG_FS
inst->debugfs_root =
msm_vidc_debugfs_init_inst(inst, core->debugfs_root);
#endif
return inst;
fail_init:
mutex_lock(&core->lock);
@ -1432,8 +1432,9 @@ int msm_vidc_destroy(struct msm_vidc_inst *inst)
mutex_destroy(&inst->bufq[CAPTURE_PORT].lock);
mutex_destroy(&inst->bufq[OUTPUT_PORT].lock);
mutex_destroy(&inst->lock);
#ifdef CONFIG_DEBUG_FS
msm_vidc_debugfs_deinit_inst(inst);
#endif
pr_info(VIDC_DBG_TAG "Closed video instance: %pK\n",
VIDC_MSG_PRIO2STRING(VIDC_INFO), inst);
kfree(inst);