@@ -327,11 +327,6 @@ static int caam_remove(struct platform_device *pdev)
327327 if (!ctrlpriv -> mc_en && ctrlpriv -> rng4_sh_init )
328328 deinstantiate_rng (ctrldev , ctrlpriv -> rng4_sh_init );
329329
330- /* Shut down debug views */
331- #ifdef CONFIG_DEBUG_FS
332- debugfs_remove_recursive (ctrlpriv -> dfs_root );
333- #endif
334-
335330 return 0 ;
336331}
337332
@@ -563,6 +558,13 @@ static int init_clocks(struct device *dev, const struct caam_imx_data *data)
563558 return devm_add_action_or_reset (dev , disable_clocks , ctrlpriv );
564559}
565560
561+ #ifdef CONFIG_DEBUG_FS
562+ static void caam_remove_debugfs (void * root )
563+ {
564+ debugfs_remove_recursive (root );
565+ }
566+ #endif
567+
566568/* Probe routine for CAAM top (controller) level */
567569static int caam_probe (struct platform_device * pdev )
568570{
@@ -575,6 +577,7 @@ static int caam_probe(struct platform_device *pdev)
575577 struct caam_drv_private * ctrlpriv ;
576578#ifdef CONFIG_DEBUG_FS
577579 struct caam_perfmon * perfmon ;
580+ struct dentry * dfs_root ;
578581#endif
579582 u32 scfgr , comp_params ;
580583 u8 rng_vid ;
@@ -728,8 +731,12 @@ static int caam_probe(struct platform_device *pdev)
728731 */
729732 perfmon = (struct caam_perfmon __force * )& ctrl -> perfmon ;
730733
731- ctrlpriv -> dfs_root = debugfs_create_dir (dev_name (dev ), NULL );
732- ctrlpriv -> ctl = debugfs_create_dir ("ctl" , ctrlpriv -> dfs_root );
734+ dfs_root = debugfs_create_dir (dev_name (dev ), NULL );
735+ ret = devm_add_action_or_reset (dev , caam_remove_debugfs , dfs_root );
736+ if (ret )
737+ return ret ;
738+
739+ ctrlpriv -> ctl = debugfs_create_dir ("ctl" , dfs_root );
733740#endif
734741
735742 /* Check to see if (DPAA 1.x) QI present. If so, enable */
0 commit comments