Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-4872

add LASSERT and CERROR warnings to checkpatch.pl

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • Lustre 2.6.0
    • Lustre 2.6.0
    • 3
    • 13465

      Add some scanning for new LASSERT()s, LCONSOLE_*()s, and CERROR()s to checkpatch.pl. So that for a change like:

      diff --git a/lustre/llite/file.c b/lustre/llite/file.c
      index e92a510..b0177e3 100644
      --- a/lustre/llite/file.c
      +++ b/lustre/llite/file.c
      @@ -55,8 +55,13 @@ struct ll_file_data *ll_file_data_get(void)
              struct ll_file_data *fd;
       
              OBD_SLAB_ALLOC_PTR_GFP(fd, ll_file_data_slab, GFP_NOFS);
      +
      +       LASSERT(fd != NULL);
      +
      +       CERROR("fd = %p\n", fd);
      +
              if (fd == NULL)
      -               return NULL;
      +               LCONSOLE_ERROR("NULL fd! Add more memory?\n");
       
              fd->fd_write_failed = false;
      

      We get:

      WARNING: try to replace LASSERT() with error handling
      #42: FILE: lustre/llite/file.c:59:
      +	LASSERT(fd != NULL);
      
      WARNING: think hard before adding new CERROR messages
      #44: FILE: lustre/llite/file.c:61:
      +	CERROR("fd = %p\n", fd);
      
      WARNING: avoid adding new console messages
      #48: FILE: lustre/llite/file.c:64:
      +		LCONSOLE_ERROR("NULL fd! Add more memory?\n");
      
      total: 0 errors, 3 warnings, 41 lines checked
      
      Your patch has style problems, please review.
      
      If any of these errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
      

            jhammond John Hammond
            jhammond John Hammond
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: