Skip to contentSkip to conversation

Fixed multiple checkpatch warnings and errors

PATCH In review Shivani Bhardwaj 2 participants 4 messages Oct 9, 2015 – Oct 10, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover Fixed multiple checkpatch warnings and errors

This patch fixes the global variable initialization error and removes the warning for character limits.

After these patches, warnings and errors thrown by checkpatch get considerably reduced. Also, the warnings given by checkpatch now cannot be fixed as it might reduce the readability and search of particular strings.

Shivani Bhardwaj (2):
Staging: lustre: ldlm_resource: Removed initialization of global
variables
Staging: lustre: ldlm_resource: Fixed character limit warning

 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/2 Staging: lustre: ldlm_resource: Removed initialization of global variables

Fixed the error generated by checkpatch : do not initialise globals to 0 or NULL, by removing the initialization of variables ldlm_srv_namespace_nr and ldlm_cli_namespace_nr.

---
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +2 -2
index 4bb3173..cc212b9 100644
@@ -47,8 +47,8 @@
 
 struct kmem_cache *ldlm_resource_slab, *ldlm_lock_slab;
 
-int ldlm_srv_namespace_nr = 0;
-int ldlm_cli_namespace_nr = 0;
+int ldlm_srv_namespace_nr;
+int ldlm_cli_namespace_nr;
 
 struct mutex ldlm_srv_namespace_lock;
 LIST_HEAD(ldlm_srv_namespace_list);
Signature · 1 line
2.1.0
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/2] Staging: lustre: ldlm_resource: Removed initialization of global variables

Quoted 6 lines · Shivani Bhardwaj

Fixed the error generated by checkpatch : do not initialise globals to 0 or NULL, by removing the initialization of variables ldlm_srv_namespace_nr and ldlm_cli_namespace_nr.

---

This has already been done by:
ea28d21ac51a ("staging: lustre: fix GLOBAL_INITIALISERS checkpatch.pl errors")

which tree you are using?

regards
sudip

#3 lore raw

PATCH 2/2 Staging: lustre: ldlm_resource: Fixed character limit warning

In reply to Shivani Bhardwaj

Fixed warning generated by checkpatch : line over 80 characters, by breaking up the lines into sensible chunks. User-visible strings were not broken as it might break the ability to grep for them.

---
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +6 -4
index cc212b9..6bc6f89 100644
@@ -778,7 +778,8 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,
 		} else {
 			ldlm_resource_unlink_lock(lock);
 			unlock_res(res);
-			LDLM_DEBUG(lock, "Freeing a lock still held by a client node");
+			LDLM_DEBUG(lock,
+				"Freeing a lock still held by a client node");
 			ldlm_lock_destroy(lock);
 		}
 		LDLM_LOCK_RELEASE(lock);
@@ -862,8 +863,8 @@ force_wait:
 		 * so it's safe to wait forever... we can't leak locks... */
 		if (force && rc == -ETIMEDOUT) {
 			LCONSOLE_ERROR("Forced cleanup waiting for %s namespace with %d resources in use, (rc=%d)\n",
-				       ldlm_ns_name(ns),
-				       atomic_read(&ns->ns_bref), rc);
+					ldlm_ns_name(ns),
+					atomic_read(&ns->ns_bref), rc);
 			goto force_wait;
 		}
 
@@ -1445,7 +1446,8 @@ void ldlm_resource_dump(int level, struct ldlm_resource *res)
 			LDLM_DEBUG_LIMIT(level, lock, "###");
 			if (!(level & D_CANTMASK) &&
 			    ++granted > ldlm_dump_granted_max) {
-				CDEBUG(level, "only dump %d granted locks to avoid DDOS.\n",
+				CDEBUG(level,
+					"only dump %d granted locks to avoid DDOS.\n",
 				       granted);
 				break;
 			}
Signature · 1 line
2.1.0