[LU-4872] add LASSERT and CERROR warnings to checkpatch.pl Created: 08/Apr/14  Updated: 03/May/14  Resolved: 03/May/14

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.6.0
Fix Version/s: Lustre 2.6.0

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: John Hammond
Resolution: Fixed Votes: 0
Labels: messages

Issue Links:
Related
is related to LU-1095 Console message cleanup Reopened
Severity: 3
Rank (Obsolete): 13465

 Description   

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.


 Comments   
Comment by John Hammond [ 08/Apr/14 ]

Please see http://review.whamcloud.com/9914.

Generated at Sat Feb 10 01:46:35 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.