]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Staging: lustre: Remove print statement on function failure
authorBhumika Goyal <bhumirks@gmail.com>
Sun, 28 Feb 2016 19:44:33 +0000 (01:14 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Mar 2016 03:38:34 +0000 (19:38 -0800)
The  memory allocation functions generates a call stack containing
all the context information on failure, so print statements can be
removed on failure of these functions. Also remove
unwanted {} around if block after removal of these statements.
Done using coccinelle:

@@
expression e,e1,e2;
identifier x;
@@
e=\(kmalloc\|kmalloc_array\|kzalloc\|
   devm_kzalloc\)(...);
...when!=e=e1
if(!e)
-{
- \(printk\|DBG_8723A\|pr_err\|CERROR\|DBG_88E\)(...);
(
goto x;
|
return e2;
|
return;
)
-}

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c
drivers/staging/lustre/lustre/obdclass/llog.c
drivers/staging/lustre/lustre/obdecho/echo_client.c

index ec758019bad6bb50f8f3540532a26741d8fb2d7e..1d2f70fda944d3313127d43b15674f9546ed8ce8 100644 (file)
@@ -251,10 +251,8 @@ static int cfs_crypto_test_hashes(void)
        unsigned int        data_len = 1 * 128 * 1024;
 
        data = kmalloc(data_len, 0);
-       if (!data) {
-               CERROR("Failed to allocate mem\n");
+       if (!data)
                return -ENOMEM;
-       }
 
        for (j = 0; j < data_len; j++)
                data[j] = j & 0xff;
index f7ee605c74d05aa20d445d733dd83f9d3d98eb00..992573eae1b12f992a756fad78161d54190b7a08 100644 (file)
@@ -365,10 +365,8 @@ int llog_process_or_fork(const struct lu_env *env,
        int                   rc;
 
        lpi = kzalloc(sizeof(*lpi), GFP_NOFS);
-       if (!lpi) {
-               CERROR("cannot alloc pointer\n");
+       if (!lpi)
                return -ENOMEM;
-       }
        lpi->lpi_loghandle = loghandle;
        lpi->lpi_cb     = cb;
        lpi->lpi_cbdata    = data;
index ec2f255d65eee3555d64389e86690e06b5ec8518..3edd7c80ce1871b22b11a4f376121d00dd7d4060 100644 (file)
@@ -1768,11 +1768,8 @@ static int echo_client_setup(const struct lu_env *env,
        ec->ec_unique = 0;
 
        ocd = kzalloc(sizeof(*ocd), GFP_NOFS);
-       if (!ocd) {
-               CERROR("Can't alloc ocd connecting to %s\n",
-                      lustre_cfg_string(lcfg, 1));
+       if (!ocd)
                return -ENOMEM;
-       }
 
        ocd->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_REQPORTAL |
                                 OBD_CONNECT_BRW_SIZE |