File 0004-LU-12635-lnet-Fix-style-issues-for-module.c-conctl.c.patch of Package lustre_2_12

From c8ba4d46e626fb291fe5ada47f1e2a56dc69e105 Mon Sep 17 00:00:00 2001
From: Shaun Tancheff <stancheff@cray.com>
Date: Mon, 26 Aug 2019 12:19:32 -0500
Subject: [PATCH 04/35] LU-12635 lnet: Fix style issues for module.c conctl.c

This patch fixes issues reported by checkpatch for the file
selftest/module.c and selftest/conctl.c.
Linux 5.3 enforces the use of 'fallthrough' which is also
suggested by checkpatch

Test-Parameters: trivial
Cray-bug-id: LUS-7690
Signed-off-by: Shaun Tancheff <stancheff@cray.com>
Change-Id: If650375f63f27c01c40e251059fa242f919854be
Reviewed-on: https://review.whamcloud.com/35802
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 lnet/selftest/conctl.c | 748 +++++++++++++++++++++--------------------
 lnet/selftest/module.c | 112 +++---
 2 files changed, 432 insertions(+), 428 deletions(-)

diff --git a/lnet/selftest/conctl.c b/lnet/selftest/conctl.c
index 4767ab882506..642a878d3dd4 100644
--- a/lnet/selftest/conctl.c
+++ b/lnet/selftest/conctl.c
@@ -44,27 +44,27 @@
 static int
 lst_session_new_ioctl(struct lstio_session_new_args *args)
 {
-        char      *name;
-        int        rc;
-
-        if (args->lstio_ses_idp   == NULL || /* address for output sid */
-            args->lstio_ses_key   == 0 || /* no key is specified */
-            args->lstio_ses_namep == NULL || /* session name */
-            args->lstio_ses_nmlen <= 0 ||
-            args->lstio_ses_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	char *name;
+	int rc;
+
+	if (args->lstio_ses_idp == NULL || /* address for output sid */
+	    args->lstio_ses_key == 0 || /* no key is specified */
+	    args->lstio_ses_namep == NULL || /* session name */
+	    args->lstio_ses_nmlen <= 0 ||
+	    args->lstio_ses_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        LIBCFS_ALLOC(name, args->lstio_ses_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_ses_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_ses_namep,
 			   args->lstio_ses_nmlen)) {
-                LIBCFS_FREE(name, args->lstio_ses_nmlen + 1);
-                return -EFAULT;
-        }
+		LIBCFS_FREE(name, args->lstio_ses_nmlen + 1);
+		return -EFAULT;
+	}
 
-        name[args->lstio_ses_nmlen] = 0;
+	name[args->lstio_ses_nmlen] = 0;
 
 	rc = lstcon_session_new(name,
 				args->lstio_ses_key,
@@ -80,271 +80,272 @@ lst_session_new_ioctl(struct lstio_session_new_args *args)
 static int
 lst_session_end_ioctl(struct lstio_session_end_args *args)
 {
-        if (args->lstio_ses_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_ses_key != console_session.ses_key)
+		return -EACCES;
 
-        return lstcon_session_end();
+	return lstcon_session_end();
 }
 
 static int
 lst_session_info_ioctl(struct lstio_session_info_args *args)
 {
-        /* no checking of key */
-
-        if (args->lstio_ses_idp   == NULL || /* address for ouput sid */
-            args->lstio_ses_keyp  == NULL || /* address for ouput key */
-	    args->lstio_ses_featp  == NULL || /* address for ouput features */
-            args->lstio_ses_ndinfo == NULL || /* address for output ndinfo */
-            args->lstio_ses_namep == NULL || /* address for ouput name */
-            args->lstio_ses_nmlen <= 0 ||
-            args->lstio_ses_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
-
-        return lstcon_session_info(args->lstio_ses_idp,
-                                   args->lstio_ses_keyp,
+	/* no checking of key */
+
+	if (args->lstio_ses_idp == NULL || /* address for ouput sid */
+	    args->lstio_ses_keyp == NULL || /* address for ouput key */
+	    args->lstio_ses_featp == NULL || /* address for ouput features */
+	    args->lstio_ses_ndinfo == NULL || /* address for output ndinfo */
+	    args->lstio_ses_namep == NULL || /* address for ouput name */
+	    args->lstio_ses_nmlen <= 0 ||
+	    args->lstio_ses_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
+
+	return lstcon_session_info(args->lstio_ses_idp,
+				   args->lstio_ses_keyp,
 				   args->lstio_ses_featp,
-                                   args->lstio_ses_ndinfo,
-                                   args->lstio_ses_namep,
-                                   args->lstio_ses_nmlen);
+				   args->lstio_ses_ndinfo,
+				   args->lstio_ses_namep,
+				   args->lstio_ses_nmlen);
 }
 
 static int
 lst_debug_ioctl(struct lstio_debug_args *args)
 {
-        char   *name   = NULL;
-        int     client = 1;
-        int     rc;
+	char *name = NULL;
+	int client = 1;
+	int rc;
 
-        if (args->lstio_dbg_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_dbg_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_dbg_resultp == NULL)
-                return -EINVAL;
+	if (args->lstio_dbg_resultp == NULL)
+		return -EINVAL;
 
-        if (args->lstio_dbg_namep != NULL && /* name of batch/group */
-            (args->lstio_dbg_nmlen <= 0 ||
-             args->lstio_dbg_nmlen > LST_NAME_SIZE))
-                return -EINVAL;
+	if (args->lstio_dbg_namep != NULL && /* name of batch/group */
+	    (args->lstio_dbg_nmlen <= 0 ||
+	     args->lstio_dbg_nmlen > LST_NAME_SIZE))
+		return -EINVAL;
 
-        if (args->lstio_dbg_namep != NULL) {
-                LIBCFS_ALLOC(name, args->lstio_dbg_nmlen + 1);
-                if (name == NULL)
-                        return -ENOMEM;
+	if (args->lstio_dbg_namep != NULL) {
+		LIBCFS_ALLOC(name, args->lstio_dbg_nmlen + 1);
+		if (name == NULL)
+			return -ENOMEM;
 
 		if (copy_from_user(name, args->lstio_dbg_namep,
-                                       args->lstio_dbg_nmlen)) {
-                        LIBCFS_FREE(name, args->lstio_dbg_nmlen + 1);
+				   args->lstio_dbg_nmlen)) {
+			LIBCFS_FREE(name, args->lstio_dbg_nmlen + 1);
 
-                        return -EFAULT;
-                }
+			return -EFAULT;
+		}
 
-                name[args->lstio_dbg_nmlen] = 0;
-        }
+		name[args->lstio_dbg_nmlen] = 0;
+	}
 
-        rc = -EINVAL;
+	rc = -EINVAL;
 
-        switch (args->lstio_dbg_type) {
-        case LST_OPC_SESSION:
-                rc = lstcon_session_debug(args->lstio_dbg_timeout,
-                                          args->lstio_dbg_resultp);
-                break;
+	switch (args->lstio_dbg_type) {
+	case LST_OPC_SESSION:
+		rc = lstcon_session_debug(args->lstio_dbg_timeout,
+					  args->lstio_dbg_resultp);
+		break;
 
-        case LST_OPC_BATCHSRV:
-                client = 0;
-        case LST_OPC_BATCHCLI:
-                if (name == NULL)
-                        goto out;
+	case LST_OPC_BATCHSRV:
+		client = 0;
+		/* fallthrough */
+	case LST_OPC_BATCHCLI:
+		if (name == NULL)
+			goto out;
 
-                rc = lstcon_batch_debug(args->lstio_dbg_timeout,
-                                        name, client, args->lstio_dbg_resultp);
-                break;
+		rc = lstcon_batch_debug(args->lstio_dbg_timeout,
+					name, client, args->lstio_dbg_resultp);
+		break;
 
-        case LST_OPC_GROUP:
-                if (name == NULL)
-                        goto out;
+	case LST_OPC_GROUP:
+		if (name == NULL)
+			goto out;
 
-                rc = lstcon_group_debug(args->lstio_dbg_timeout,
-                                        name, args->lstio_dbg_resultp);
-                break;
+		rc = lstcon_group_debug(args->lstio_dbg_timeout,
+					name, args->lstio_dbg_resultp);
+		break;
 
-        case LST_OPC_NODES:
-                if (args->lstio_dbg_count <= 0 ||
-                    args->lstio_dbg_idsp == NULL)
-                        goto out;
+	case LST_OPC_NODES:
+		if (args->lstio_dbg_count <= 0 ||
+		    args->lstio_dbg_idsp == NULL)
+			goto out;
 
-                rc = lstcon_nodes_debug(args->lstio_dbg_timeout,
-                                        args->lstio_dbg_count,
-                                        args->lstio_dbg_idsp,
-                                        args->lstio_dbg_resultp);
-                break;
+		rc = lstcon_nodes_debug(args->lstio_dbg_timeout,
+					args->lstio_dbg_count,
+					args->lstio_dbg_idsp,
+					args->lstio_dbg_resultp);
+		break;
 
-        default:
-                break;
-        }
+	default:
+		break;
+	}
 
 out:
-        if (name != NULL)
-                LIBCFS_FREE(name, args->lstio_dbg_nmlen + 1);
+	if (name != NULL)
+		LIBCFS_FREE(name, args->lstio_dbg_nmlen + 1);
 
-        return rc;
+	return rc;
 }
 
 static int
 lst_group_add_ioctl(struct lstio_group_add_args *args)
 {
-        char           *name;
-        int             rc;
+	char *name;
+	int rc;
 
-        if (args->lstio_grp_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_grp_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_grp_namep == NULL||
+	if (args->lstio_grp_namep == NULL ||
 	    args->lstio_grp_nmlen <= 0 ||
-            args->lstio_grp_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	    args->lstio_grp_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_grp_namep,
 			   args->lstio_grp_nmlen)) {
-                LIBCFS_FREE(name, args->lstio_grp_nmlen);
-                return -EFAULT;
-        }
+		LIBCFS_FREE(name, args->lstio_grp_nmlen);
+		return -EFAULT;
+	}
 
-        name[args->lstio_grp_nmlen] = 0;
+	name[args->lstio_grp_nmlen] = 0;
 
-        rc = lstcon_group_add(name);
+	rc = lstcon_group_add(name);
 
-        LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
+	LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
 
-        return rc;
+	return rc;
 }
 
 static int
 lst_group_del_ioctl(struct lstio_group_del_args *args)
 {
-        int     rc;
-        char   *name;
+	int rc;
+	char *name;
 
-        if (args->lstio_grp_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_grp_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_grp_namep == NULL ||
-            args->lstio_grp_nmlen <= 0 ||
-            args->lstio_grp_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	if (args->lstio_grp_namep == NULL ||
+	    args->lstio_grp_nmlen <= 0 ||
+	    args->lstio_grp_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_grp_namep,
 			   args->lstio_grp_nmlen)) {
-                LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
-                return -EFAULT;
-        }
+		LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
+		return -EFAULT;
+	}
 
-        name[args->lstio_grp_nmlen] = 0;
+	name[args->lstio_grp_nmlen] = 0;
 
-        rc = lstcon_group_del(name);
+	rc = lstcon_group_del(name);
 
-        LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
+	LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
 
-        return rc;
+	return rc;
 }
 
 static int
 lst_group_update_ioctl(struct lstio_group_update_args *args)
 {
-        int     rc;
-        char   *name;
+	int rc;
+	char *name;
 
-        if (args->lstio_grp_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_grp_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_grp_resultp == NULL ||
-            args->lstio_grp_namep == NULL ||
+	if (args->lstio_grp_resultp == NULL ||
+	    args->lstio_grp_namep == NULL ||
 	    args->lstio_grp_nmlen <= 0 ||
-            args->lstio_grp_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	    args->lstio_grp_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_grp_namep,
 			   args->lstio_grp_nmlen)) {
-                LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
-                return -EFAULT;
-        }
-
-        name[args->lstio_grp_nmlen] = 0;
-
-        switch (args->lstio_grp_opc) {
-        case LST_GROUP_CLEAN:
-                rc = lstcon_group_clean(name, args->lstio_grp_args);
-                break;
-
-        case LST_GROUP_REFRESH:
-                rc = lstcon_group_refresh(name, args->lstio_grp_resultp);
-                break;
-
-        case LST_GROUP_RMND:
-                if (args->lstio_grp_count  <= 0 ||
-                    args->lstio_grp_idsp == NULL) {
-                        rc = -EINVAL;
-                        break;
-                }
-                rc = lstcon_nodes_remove(name, args->lstio_grp_count,
-                                         args->lstio_grp_idsp,
-                                         args->lstio_grp_resultp);
-                break;
-
-        default:
-                rc = -EINVAL;
-                break;
-        }
-
-        LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
-
-        return rc;
+		LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
+		return -EFAULT;
+	}
+
+	name[args->lstio_grp_nmlen] = 0;
+
+	switch (args->lstio_grp_opc) {
+	case LST_GROUP_CLEAN:
+		rc = lstcon_group_clean(name, args->lstio_grp_args);
+		break;
+
+	case LST_GROUP_REFRESH:
+		rc = lstcon_group_refresh(name, args->lstio_grp_resultp);
+		break;
+
+	case LST_GROUP_RMND:
+		if (args->lstio_grp_count <= 0 ||
+		    args->lstio_grp_idsp == NULL) {
+			rc = -EINVAL;
+			break;
+		}
+		rc = lstcon_nodes_remove(name, args->lstio_grp_count,
+					 args->lstio_grp_idsp,
+					 args->lstio_grp_resultp);
+		break;
+
+	default:
+		rc = -EINVAL;
+		break;
+	}
+
+	LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
+
+	return rc;
 }
 
 static int
 lst_nodes_add_ioctl(struct lstio_group_nodes_args *args)
 {
-	unsigned feats;
-        int     rc;
-        char   *name;
+	unsigned int feats;
+	int rc;
+	char *name;
 
-        if (args->lstio_grp_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_grp_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_grp_idsp == NULL || /* array of ids */
-            args->lstio_grp_count <= 0 ||
-            args->lstio_grp_resultp == NULL ||
+	if (args->lstio_grp_idsp == NULL || /* array of ids */
+	    args->lstio_grp_count <= 0 ||
+	    args->lstio_grp_resultp == NULL ||
 	    args->lstio_grp_featp == NULL ||
 	    args->lstio_grp_namep == NULL ||
 	    args->lstio_grp_nmlen <= 0 ||
-            args->lstio_grp_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	    args->lstio_grp_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_grp_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_grp_namep,
-                               args->lstio_grp_nmlen)) {
-                LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
+			   args->lstio_grp_nmlen)) {
+		LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
 
-                return -EFAULT;
-        }
+		return -EFAULT;
+	}
 
-        name[args->lstio_grp_nmlen] = 0;
+	name[args->lstio_grp_nmlen] = 0;
 
-        rc = lstcon_nodes_add(name, args->lstio_grp_count,
+	rc = lstcon_nodes_add(name, args->lstio_grp_count,
 			      args->lstio_grp_idsp, &feats,
 			      args->lstio_grp_resultp);
 
@@ -354,50 +355,50 @@ lst_nodes_add_ioctl(struct lstio_group_nodes_args *args)
 		return -EINVAL;
 	}
 
-        return rc;
+	return rc;
 }
 
 static int
 lst_group_list_ioctl(struct lstio_group_list_args *args)
 {
 	if (args->lstio_grp_key != console_session.ses_key)
-                return -EACCES;
+		return -EACCES;
 
-        if (args->lstio_grp_idx   < 0 ||
-            args->lstio_grp_namep == NULL ||
-            args->lstio_grp_nmlen <= 0 ||
-            args->lstio_grp_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	if (args->lstio_grp_idx   < 0 ||
+	    args->lstio_grp_namep == NULL ||
+	    args->lstio_grp_nmlen <= 0 ||
+	    args->lstio_grp_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        return lstcon_group_list(args->lstio_grp_idx,
-                              args->lstio_grp_nmlen,
-                              args->lstio_grp_namep);
+	return lstcon_group_list(args->lstio_grp_idx,
+				 args->lstio_grp_nmlen,
+				 args->lstio_grp_namep);
 }
 
 static int
 lst_group_info_ioctl(struct lstio_group_info_args *args)
 {
-        char           *name;
-        int             ndent;
-        int             index;
-        int             rc;
+	char *name;
+	int ndent;
+	int index;
+	int rc;
 
-        if (args->lstio_grp_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_grp_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_grp_namep == NULL ||
-            args->lstio_grp_nmlen <= 0 ||
-            args->lstio_grp_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	if (args->lstio_grp_namep == NULL ||
+	    args->lstio_grp_nmlen <= 0 ||
+	    args->lstio_grp_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        if (args->lstio_grp_entp  == NULL && /* output: group entry */
-            args->lstio_grp_dentsp == NULL)  /* output: node entry */
-                return -EINVAL;
+	if (args->lstio_grp_entp == NULL && /* output: group entry */
+	    args->lstio_grp_dentsp == NULL)  /* output: node entry */
+		return -EINVAL;
 
-        if (args->lstio_grp_dentsp != NULL) { /* have node entry */
-                if (args->lstio_grp_idxp == NULL || /* node index */
-                    args->lstio_grp_ndentp == NULL) /* # of node entry */
-                        return -EINVAL;
+	if (args->lstio_grp_dentsp != NULL) { /* have node entry */
+		if (args->lstio_grp_idxp == NULL || /* node index */
+		    args->lstio_grp_ndentp == NULL) /* # of node entry */
+			return -EINVAL;
 
 		if (copy_from_user(&ndent, args->lstio_grp_ndentp,
 				   sizeof(ndent)) ||
@@ -415,19 +416,19 @@ lst_group_info_ioctl(struct lstio_group_info_args *args)
 
 	if (copy_from_user(name, args->lstio_grp_namep,
 			   args->lstio_grp_nmlen)) {
-                LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
-                return -EFAULT;
-        }
+		LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
+		return -EFAULT;
+	}
 
-        name[args->lstio_grp_nmlen] = 0;
+	name[args->lstio_grp_nmlen] = 0;
 
-        rc = lstcon_group_info(name, args->lstio_grp_entp,
-                               &index, &ndent, args->lstio_grp_dentsp);
+	rc = lstcon_group_info(name, args->lstio_grp_entp,
+			       &index, &ndent, args->lstio_grp_dentsp);
 
-        LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
+	LIBCFS_FREE(name, args->lstio_grp_nmlen + 1);
 
 	if (rc != 0)
-                return rc;
+		return rc;
 
 	if (args->lstio_grp_dentsp != NULL &&
 	    (copy_to_user(args->lstio_grp_idxp, &index, sizeof(index)) ||
@@ -440,20 +441,20 @@ lst_group_info_ioctl(struct lstio_group_info_args *args)
 static int
 lst_batch_add_ioctl(struct lstio_batch_add_args *args)
 {
-        int             rc;
-        char           *name;
+	int rc;
+	char *name;
 
-        if (args->lstio_bat_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_bat_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_bat_namep == NULL ||
-            args->lstio_bat_nmlen <= 0 ||
-            args->lstio_bat_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	if (args->lstio_bat_namep == NULL ||
+	    args->lstio_bat_nmlen <= 0 ||
+	    args->lstio_bat_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_bat_namep,
 			   args->lstio_bat_nmlen)) {
@@ -461,32 +462,32 @@ lst_batch_add_ioctl(struct lstio_batch_add_args *args)
 		return -EFAULT;
 	}
 
-        name[args->lstio_bat_nmlen] = 0;
+	name[args->lstio_bat_nmlen] = 0;
 
-        rc = lstcon_batch_add(name);
+	rc = lstcon_batch_add(name);
 
-        LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
+	LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
 
-        return rc;
+	return rc;
 }
 
 static int
 lst_batch_run_ioctl(struct lstio_batch_run_args *args)
 {
-        int             rc;
-        char           *name;
+	int rc;
+	char *name;
 
-        if (args->lstio_bat_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_bat_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_bat_namep == NULL ||
-            args->lstio_bat_nmlen <= 0 ||
-            args->lstio_bat_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	if (args->lstio_bat_namep == NULL ||
+	    args->lstio_bat_nmlen <= 0 ||
+	    args->lstio_bat_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_bat_namep,
 			   args->lstio_bat_nmlen)) {
@@ -494,34 +495,34 @@ lst_batch_run_ioctl(struct lstio_batch_run_args *args)
 		return -EFAULT;
 	}
 
-        name[args->lstio_bat_nmlen] = 0;
+	name[args->lstio_bat_nmlen] = 0;
 
-        rc = lstcon_batch_run(name, args->lstio_bat_timeout,
-                              args->lstio_bat_resultp);
+	rc = lstcon_batch_run(name, args->lstio_bat_timeout,
+			      args->lstio_bat_resultp);
 
-        LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
+	LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
 
-        return rc;
+	return rc;
 }
 
 static int
 lst_batch_stop_ioctl(struct lstio_batch_stop_args *args)
 {
-        int             rc;
-        char           *name;
+	int rc;
+	char *name;
 
-        if (args->lstio_bat_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_bat_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_bat_resultp == NULL ||
-            args->lstio_bat_namep == NULL ||
-            args->lstio_bat_nmlen <= 0 ||
-            args->lstio_bat_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	if (args->lstio_bat_resultp == NULL ||
+	    args->lstio_bat_namep == NULL ||
+	    args->lstio_bat_nmlen <= 0 ||
+	    args->lstio_bat_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_bat_namep,
 			   args->lstio_bat_nmlen)) {
@@ -529,37 +530,37 @@ lst_batch_stop_ioctl(struct lstio_batch_stop_args *args)
 		return -EFAULT;
 	}
 
-        name[args->lstio_bat_nmlen] = 0;
+	name[args->lstio_bat_nmlen] = 0;
 
-        rc = lstcon_batch_stop(name, args->lstio_bat_force,
-                               args->lstio_bat_resultp);
+	rc = lstcon_batch_stop(name, args->lstio_bat_force,
+			       args->lstio_bat_resultp);
 
-        LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
+	LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
 
-        return rc;
+	return rc;
 }
 
 static int
 lst_batch_query_ioctl(struct lstio_batch_query_args *args)
 {
-        char   *name;
-        int     rc;
+	char *name;
+	int rc;
 
-        if (args->lstio_bat_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_bat_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_bat_resultp == NULL ||
-            args->lstio_bat_namep == NULL ||
-            args->lstio_bat_nmlen <= 0 ||
-            args->lstio_bat_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	if (args->lstio_bat_resultp == NULL ||
+	    args->lstio_bat_namep == NULL ||
+	    args->lstio_bat_nmlen <= 0 ||
+	    args->lstio_bat_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        if (args->lstio_bat_testidx < 0)
-                return -EINVAL;
+	if (args->lstio_bat_testidx < 0)
+		return -EINVAL;
 
-        LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_bat_namep,
 			   args->lstio_bat_nmlen)) {
@@ -567,92 +568,92 @@ lst_batch_query_ioctl(struct lstio_batch_query_args *args)
 		return -EFAULT;
 	}
 
-        name[args->lstio_bat_nmlen] = 0;
+	name[args->lstio_bat_nmlen] = 0;
 
-        rc = lstcon_test_batch_query(name,
-                                     args->lstio_bat_testidx,
-                                     args->lstio_bat_client,
-                                     args->lstio_bat_timeout,
-                                     args->lstio_bat_resultp);
+	rc = lstcon_test_batch_query(name,
+				     args->lstio_bat_testidx,
+				     args->lstio_bat_client,
+				     args->lstio_bat_timeout,
+				     args->lstio_bat_resultp);
 
-        LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
+	LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
 
-        return rc;
+	return rc;
 }
 
 static int
 lst_batch_list_ioctl(struct lstio_batch_list_args *args)
 {
-        if (args->lstio_bat_key != console_session.ses_key)
-                return -EACCES;
-
-        if (args->lstio_bat_idx   < 0 ||
-            args->lstio_bat_namep == NULL ||
-            args->lstio_bat_nmlen <= 0 ||
-            args->lstio_bat_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
-
-        return lstcon_batch_list(args->lstio_bat_idx,
-                              args->lstio_bat_nmlen,
-                              args->lstio_bat_namep);
+	if (args->lstio_bat_key != console_session.ses_key)
+		return -EACCES;
+
+	if (args->lstio_bat_idx < 0 ||
+	    args->lstio_bat_namep == NULL ||
+	    args->lstio_bat_nmlen <= 0 ||
+	    args->lstio_bat_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
+
+	return lstcon_batch_list(args->lstio_bat_idx,
+				 args->lstio_bat_nmlen,
+				 args->lstio_bat_namep);
 }
 
 static int
 lst_batch_info_ioctl(struct lstio_batch_info_args *args)
 {
-        char           *name;
-        int             rc;
-        int             index;
-        int             ndent;
+	char *name;
+	int rc;
+	int index;
+	int ndent;
 
-        if (args->lstio_bat_key != console_session.ses_key)
-                return -EACCES;
+	if (args->lstio_bat_key != console_session.ses_key)
+		return -EACCES;
 
-        if (args->lstio_bat_namep == NULL || /* batch name */
-            args->lstio_bat_nmlen <= 0 ||
-            args->lstio_bat_nmlen > LST_NAME_SIZE)
-                return -EINVAL;
+	if (args->lstio_bat_namep == NULL || /* batch name */
+	    args->lstio_bat_nmlen <= 0 ||
+	    args->lstio_bat_nmlen > LST_NAME_SIZE)
+		return -EINVAL;
 
-        if (args->lstio_bat_entp == NULL && /* output: batch entry */
-            args->lstio_bat_dentsp == NULL) /* output: node entry */
-                return -EINVAL;
+	if (args->lstio_bat_entp == NULL && /* output: batch entry */
+	    args->lstio_bat_dentsp == NULL) /* output: node entry */
+		return -EINVAL;
 
-        if (args->lstio_bat_dentsp != NULL) { /* have node entry */
-                if (args->lstio_bat_idxp == NULL || /* node index */
-                    args->lstio_bat_ndentp == NULL) /* # of node entry */
-                        return -EINVAL;
+	if (args->lstio_bat_dentsp != NULL) { /* have node entry */
+		if (args->lstio_bat_idxp == NULL || /* node index */
+		    args->lstio_bat_ndentp == NULL) /* # of node entry */
+			return -EINVAL;
 
 		if (copy_from_user(&index, args->lstio_bat_idxp,
-                                       sizeof(index)) ||
+				   sizeof(index)) ||
 		    copy_from_user(&ndent, args->lstio_bat_ndentp,
-                                       sizeof(ndent)))
-                        return -EFAULT;
+				   sizeof(ndent)))
+			return -EFAULT;
 
-                if (ndent <= 0 || index < 0)
-                        return -EINVAL;
-        }
+		if (ndent <= 0 || index < 0)
+			return -EINVAL;
+	}
 
-        LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
-        if (name == NULL)
-                return -ENOMEM;
+	LIBCFS_ALLOC(name, args->lstio_bat_nmlen + 1);
+	if (name == NULL)
+		return -ENOMEM;
 
 	if (copy_from_user(name, args->lstio_bat_namep,
 			   args->lstio_bat_nmlen)) {
-                LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
-                return -EFAULT;
-        }
+		LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
+		return -EFAULT;
+	}
 
-        name[args->lstio_bat_nmlen] = 0;
+	name[args->lstio_bat_nmlen] = 0;
 
-        rc = lstcon_batch_info(name,
-                            args->lstio_bat_entp, args->lstio_bat_server,
-                            args->lstio_bat_testidx, &index, &ndent,
-                            args->lstio_bat_dentsp);
+	rc = lstcon_batch_info(name,
+			       args->lstio_bat_entp, args->lstio_bat_server,
+			       args->lstio_bat_testidx, &index, &ndent,
+			       args->lstio_bat_dentsp);
 
-        LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
+	LIBCFS_FREE(name, args->lstio_bat_nmlen + 1);
 
-        if (rc != 0)
-                return rc;
+	if (rc != 0)
+		return rc;
 
 	if (args->lstio_bat_dentsp != NULL &&
 	    (copy_to_user(args->lstio_bat_idxp, &index, sizeof(index)) ||
@@ -665,12 +666,12 @@ lst_batch_info_ioctl(struct lstio_batch_info_args *args)
 static int
 lst_stat_query_ioctl(struct lstio_stat_args *args)
 {
-        int             rc;
-	char           *name = NULL;
+	int rc;
+	char *name = NULL;
 
-        /* TODO: not finished */
-        if (args->lstio_sta_key != console_session.ses_key)
-                return -EACCES;
+	/* TODO: not finished */
+	if (args->lstio_sta_key != console_session.ses_key)
+		return -EACCES;
 
 	if (args->lstio_sta_resultp == NULL)
 		return -EINVAL;
@@ -680,9 +681,9 @@ lst_stat_query_ioctl(struct lstio_stat_args *args)
 			return -EINVAL;
 
 		rc = lstcon_nodes_stat(args->lstio_sta_count,
-                                       args->lstio_sta_idsp,
-                                       args->lstio_sta_timeout,
-                                       args->lstio_sta_resultp);
+				       args->lstio_sta_idsp,
+				       args->lstio_sta_timeout,
+				       args->lstio_sta_resultp);
 	} else if (args->lstio_sta_namep != NULL) {
 		if (args->lstio_sta_nmlen <= 0 ||
 		    args->lstio_sta_nmlen > LST_NAME_SIZE)
@@ -711,12 +712,12 @@ lst_stat_query_ioctl(struct lstio_stat_args *args)
 
 static int lst_test_add_ioctl(struct lstio_test_args *args)
 {
-	char		*batch_name;
-	char		*src_name = NULL;
-	char		*dst_name = NULL;
-	void		*param = NULL;
-	int		ret = 0;
-	int		rc = -ENOMEM;
+	char *batch_name;
+	char *src_name = NULL;
+	char *dst_name = NULL;
+	void *param = NULL;
+	int ret = 0;
+	int rc = -ENOMEM;
 
 	if (args->lstio_tes_resultp == NULL ||
 	    args->lstio_tes_retp == NULL ||
@@ -737,12 +738,12 @@ static int lst_test_add_ioctl(struct lstio_test_args *args)
 	    args->lstio_tes_span <= 0)
 		return -EINVAL;
 
-        /* have parameter, check if parameter length is valid */
-        if (args->lstio_tes_param != NULL &&
-            (args->lstio_tes_param_len <= 0 ||
+	/* have parameter, check if parameter length is valid */
+	if (args->lstio_tes_param != NULL &&
+	    (args->lstio_tes_param_len <= 0 ||
 	     args->lstio_tes_param_len >
 	     PAGE_SIZE - sizeof(struct lstcon_test)))
-                return -EINVAL;
+		return -EINVAL;
 
 	LIBCFS_ALLOC(batch_name, args->lstio_tes_bat_nmlen + 1);
 	if (batch_name == NULL)
@@ -777,17 +778,17 @@ static int lst_test_add_ioctl(struct lstio_test_args *args)
 		goto out;
 
 	rc = lstcon_test_add(batch_name,
-			    args->lstio_tes_type,
-			    args->lstio_tes_loop,
-			    args->lstio_tes_concur,
-			    args->lstio_tes_dist, args->lstio_tes_span,
-			    src_name, dst_name, param,
-			    args->lstio_tes_param_len,
-			    &ret, args->lstio_tes_resultp);
-
-        if (ret != 0)
+			     args->lstio_tes_type,
+			     args->lstio_tes_loop,
+			     args->lstio_tes_concur,
+			     args->lstio_tes_dist, args->lstio_tes_span,
+			     src_name, dst_name, param,
+			     args->lstio_tes_param_len,
+			     &ret, args->lstio_tes_resultp);
+
+	if (ret != 0)
 		rc = (copy_to_user(args->lstio_tes_retp, &ret,
-                                       sizeof(ret))) ? -EFAULT : 0;
+				   sizeof(ret))) ? -EFAULT : 0;
 out:
 	if (batch_name != NULL)
 		LIBCFS_FREE(batch_name, args->lstio_tes_bat_nmlen + 1);
@@ -855,7 +856,8 @@ lstcon_ioctl_entry(struct notifier_block *nb,
 		goto out;
 	}
 
-	memset(&console_session.ses_trans_stat, 0, sizeof(struct lstcon_trans_stat));
+	memset(&console_session.ses_trans_stat, 0,
+	       sizeof(struct lstcon_trans_stat));
 
 	switch (opc) {
 	case LSTIO_SESSION_NEW:
diff --git a/lnet/selftest/module.c b/lnet/selftest/module.c
index df66eab0fd2d..532495750094 100644
--- a/lnet/selftest/module.c
+++ b/lnet/selftest/module.c
@@ -52,36 +52,39 @@ struct cfs_wi_sched **lst_sched_test;
 static void
 lnet_selftest_exit(void)
 {
-	int	i;
-
-        switch (lst_init_step) {
-                case LST_INIT_CONSOLE:
-                        lstcon_console_fini();
-                case LST_INIT_FW:
-                        sfw_shutdown();
-                case LST_INIT_RPC:
-                        srpc_shutdown();
-		case LST_INIT_WI_TEST:
-			for (i = 0;
-			     i < cfs_cpt_number(lnet_cpt_table()); i++) {
-				if (lst_sched_test[i] == NULL)
-					continue;
-				cfs_wi_sched_destroy(lst_sched_test[i]);
-			}
-			LIBCFS_FREE(lst_sched_test,
-				    sizeof(lst_sched_test[0]) *
-				    cfs_cpt_number(lnet_cpt_table()));
-			lst_sched_test = NULL;
-
-		case LST_INIT_WI_SERIAL:
-			cfs_wi_sched_destroy(lst_sched_serial);
-			lst_sched_serial = NULL;
-                case LST_INIT_NONE:
-                        break;
-                default:
-                        LBUG();
-        }
-        return;
+	int i;
+
+	switch (lst_init_step) {
+	case LST_INIT_CONSOLE:
+		lstcon_console_fini();
+		/* fallthrough */
+	case LST_INIT_FW:
+		sfw_shutdown();
+		/* fallthrough */
+	case LST_INIT_RPC:
+		srpc_shutdown();
+		/* fallthrough */
+	case LST_INIT_WI_TEST:
+		for (i = 0;
+		     i < cfs_cpt_number(lnet_cpt_table()); i++) {
+			if (lst_sched_test[i] == NULL)
+				continue;
+			cfs_wi_sched_destroy(lst_sched_test[i]);
+		}
+		LIBCFS_FREE(lst_sched_test,
+			    sizeof(lst_sched_test[0]) *
+			    cfs_cpt_number(lnet_cpt_table()));
+		lst_sched_test = NULL;
+		/* fallthrough */
+	case LST_INIT_WI_SERIAL:
+		cfs_wi_sched_destroy(lst_sched_serial);
+		lst_sched_serial = NULL;
+		/* fallthrough */
+	case LST_INIT_NONE:
+		break;
+	default:
+		LBUG();
+	}
 }
 
 void
@@ -93,15 +96,14 @@ lnet_selftest_structure_assertion(void)
 	CLASSERT(offsetof(struct srpc_msg, msg_body.tes_reqst.tsr_ndest) == 78);
 	CLASSERT(sizeof(struct srpc_stat_reply) == 136);
 	CLASSERT(sizeof(struct srpc_stat_reqst) == 28);
-
 }
 
 static int __init
 lnet_selftest_init(void)
 {
-	int	nscheds;
-	int	rc;
-	int	i;
+	int nscheds;
+	int rc;
+	int i;
 
 	rc = cfs_wi_sched_create("lst_s", lnet_cpt_table(), CFS_CPT_ANY,
 				 1, &lst_sched_serial);
@@ -125,31 +127,31 @@ lnet_selftest_init(void)
 		rc = cfs_wi_sched_create("lst_t", lnet_cpt_table(), i,
 					 nthrs, &lst_sched_test[i]);
 		if (rc != 0) {
-			CERROR("Failed to create CPU partition affinity WI "
-			       "scheduler %d for LST\n", i);
+			CERROR("Failed to create CPU partition affinity WI scheduler %d for LST\n",
+			       i);
 			goto error;
 		}
 	}
 
-        rc = srpc_startup();
-        if (rc != 0) {
-                CERROR("LST can't startup rpc\n");
-                goto error;
-        }
-        lst_init_step = LST_INIT_RPC;
-
-        rc = sfw_startup();
-        if (rc != 0) {
-                CERROR("LST can't startup framework\n");
-                goto error;
-        }
-        lst_init_step = LST_INIT_FW;
-
-        rc = lstcon_console_init();
-        if (rc != 0) {
-                CERROR("LST can't startup console\n");
-                goto error;
-        }
+	rc = srpc_startup();
+	if (rc != 0) {
+		CERROR("LST can't startup rpc\n");
+		goto error;
+	}
+	lst_init_step = LST_INIT_RPC;
+
+	rc = sfw_startup();
+	if (rc != 0) {
+		CERROR("LST can't startup framework\n");
+		goto error;
+	}
+	lst_init_step = LST_INIT_FW;
+
+	rc = lstcon_console_init();
+	if (rc != 0) {
+		CERROR("LST can't startup console\n");
+		goto error;
+	}
 	lst_init_step = LST_INIT_CONSOLE;
 	return 0;
 error:
-- 
2.41.0

openSUSE Build Service is sponsored by