@@ -391,25 +391,24 @@ ib_load_config(const char *cp, int writeconf, pmdaIndom *itab, unsigned int nind
391391 /* else no config file: Just monitor local ports */
392392
393393 for (i = 0 ; i < n ; i ++ ) {
394- print (hcas [i ]);
395- if (umad_get_ca (hcas [i ], & st [i ].ca ) == 0 ) {
396- int e = pmdaCacheStore (itab [IB_HCA_INDOM ].it_indom , PMDA_CACHE_ADD ,
397- st [i ].ca .ca_name , & st [i ].ca );
398-
399- if (e < 0 ) {
400- pmNotifyErr (LOG_ERR ,
401- "Cannot add instance for %s to the cache - %s\n" ,
402- st [i ].ca .ca_name , pmErrStr (e ));
403- continue ;
404- }
394+ if (umad_get_ca (hcas [i ], & st [i ].ca ) == 0 ) {
395+ sts = pmdaCacheStore (itab [IB_HCA_INDOM ].it_indom , PMDA_CACHE_ADD ,
396+ st [i ].ca .ca_name , & st [i ].ca );
397+
398+ if (sts < 0 ) {
399+ pmNotifyErr (LOG_ERR ,
400+ "Cannot add instance for %s to the cache - %s\n" ,
401+ st [i ].ca .ca_name , pmErrStr (sts ));
402+ continue ;
403+ }
405404
406- foreachport (st + i , openumadport , NULL );
407- if (fconf == NULL )
408- /* No config file - monitor local ports */
409- foreachport (st + i , monitorport , itab );
410- if (writeconf )
411- foreachport (st + i , printportconfig , fconf );
412- }
405+ foreachport (st + i , openumadport , NULL );
406+ if (fconf == NULL )
407+ /* No config file - monitor local ports */
408+ foreachport (st + i , monitorport , itab );
409+ if (writeconf )
410+ foreachport (st + i , printportconfig , fconf );
411+ }
413412 }
414413
415414 if (fconf ) {
@@ -441,7 +440,6 @@ ib_load_config(const char *cp, int writeconf, pmdaIndom *itab, unsigned int nind
441440 for (i = 0 ; i < ARRAYSZ (mad_cnt_descriptors ); i ++ ) {
442441 itab [IB_CNT_INDOM ].it_set [i ].i_inst = i ;
443442 itab [IB_CNT_INDOM ].it_set [i ].i_name = mad_cnt_descriptors [i ].name ;
444-
445443 }
446444
447445 return 0 ;
@@ -591,13 +589,13 @@ char* read_sysfs_file(const char* filename)
591589 FILE * file ;
592590 char * buffer = NULL ;
593591 size_t total_size = 0 ;
594- size_t buffer_size = 0 ;
595- const size_t CHUNK_SIZE = 256 ;
592+ size_t buffer_size ;
593+ const size_t CHUNK_SIZE = 256 ;
596594 char chunk [CHUNK_SIZE ];
597595
598596 file = fopen (filename , "r" );
599597 if (file == NULL ) {
600- pmNotifyErr (LOG_INFO , "Failed to open file" );
598+ pmNotifyErr (LOG_INFO , "Failed to open file: %s" , filename );
601599 return NULL ;
602600 }
603601
@@ -631,7 +629,7 @@ char* read_sysfs_file(const char* filename)
631629 buffer [total_size ] = '\0' ;
632630
633631 if (ferror (file )) {
634- pmNotifyErr (LOG_INFO , "Error reading file" );
632+ pmNotifyErr (LOG_INFO , "Error reading sysfs file" );
635633 free (buffer );
636634 buffer = NULL ;
637635 }
0 commit comments