@@ -244,17 +244,6 @@ static void shutdown_mem_profiling(bool remove_file)
244
244
mem_profiling_support = false;
245
245
}
246
246
247
- static void __init procfs_init (void )
248
- {
249
- if (!mem_profiling_support )
250
- return ;
251
-
252
- if (!proc_create_seq (ALLOCINFO_FILE_NAME , 0400 , NULL , & allocinfo_seq_op )) {
253
- pr_err ("Failed to create %s file\n" , ALLOCINFO_FILE_NAME );
254
- shutdown_mem_profiling (false);
255
- }
256
- }
257
-
258
247
void __init alloc_tag_sec_init (void )
259
248
{
260
249
struct alloc_tag * last_codetag ;
@@ -762,19 +751,34 @@ static int __init alloc_tag_init(void)
762
751
};
763
752
int res ;
764
753
754
+ sysctl_init ();
755
+
756
+ if (!mem_profiling_support ) {
757
+ pr_info ("Memory allocation profiling is not supported!\n" );
758
+ return 0 ;
759
+ }
760
+
761
+ if (!proc_create_seq (ALLOCINFO_FILE_NAME , 0400 , NULL , & allocinfo_seq_op )) {
762
+ pr_err ("Failed to create %s file\n" , ALLOCINFO_FILE_NAME );
763
+ shutdown_mem_profiling (false);
764
+ return - ENOMEM ;
765
+ }
766
+
765
767
res = alloc_mod_tags_mem ();
766
- if (res )
768
+ if (res ) {
769
+ pr_err ("Failed to reserve address space for module tags, errno = %d\n" , res );
770
+ shutdown_mem_profiling (true);
767
771
return res ;
772
+ }
768
773
769
774
alloc_tag_cttype = codetag_register_type (& desc );
770
775
if (IS_ERR (alloc_tag_cttype )) {
776
+ pr_err ("Allocation tags registration failed, errno = %ld\n" , PTR_ERR (alloc_tag_cttype ));
771
777
free_mod_tags_mem ();
778
+ shutdown_mem_profiling (true);
772
779
return PTR_ERR (alloc_tag_cttype );
773
780
}
774
781
775
- sysctl_init ();
776
- procfs_init ();
777
-
778
782
return 0 ;
779
783
}
780
784
module_init (alloc_tag_init );
0 commit comments