Whamcloud - gitweb
LU-15220 lnet: use 'fallthrough' pseudo keyword for switch
[fs/lustre-release.git] / lnet / selftest / module.c
index a6a06d1..1441600 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 #define DEBUG_SUBSYSTEM S_LNET
@@ -57,13 +56,13 @@ lnet_selftest_exit(void)
        switch (lst_init_step) {
        case LST_INIT_CONSOLE:
                lstcon_console_fini();
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_FW:
                sfw_shutdown();
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_RPC:
                srpc_shutdown();
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_WI_TEST:
                for (i = 0;
                     i < cfs_cpt_number(lnet_cpt_table()); i++) {
@@ -71,15 +70,14 @@ lnet_selftest_exit(void)
                                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()));
+               CFS_FREE_PTR_ARRAY(lst_sched_test,
+                                  cfs_cpt_number(lnet_cpt_table()));
                lst_sched_test = NULL;
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_WI_SERIAL:
                cfs_wi_sched_destroy(lst_sched_serial);
                lst_sched_serial = NULL;
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_NONE:
                break;
        default:
@@ -116,9 +114,11 @@ lnet_selftest_init(void)
        lst_init_step = LST_INIT_WI_SERIAL;
 
        nscheds = cfs_cpt_number(lnet_cpt_table());
-       LIBCFS_ALLOC(lst_sched_test, sizeof(lst_sched_test[0]) * nscheds);
-       if (lst_sched_test == NULL)
+       CFS_ALLOC_PTR_ARRAY(lst_sched_test, nscheds);
+       if (lst_sched_test == NULL) {
+               rc = -ENOMEM;
                goto error;
+       }
 
        lst_init_step = LST_INIT_WI_TEST;
        for (i = 0; i < nscheds; i++) {