All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Farrell <paf@cray.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] Fwd: [HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to check for kzalloc failure
Date: Mon, 22 Jun 2015 10:46:15 -0500	[thread overview]
Message-ID: <55882DC7.6060802@cray.com> (raw)
In-Reply-To: <1434819550-3193-2-git-send-email-Julia.Lawall@lip6.fr>

Question for lustre-devel...  Isn't this the opposite of the style that 
we're currently trying to use in Gerrit submissions?  Is my memory faulty?


-------- Original Message --------
Subject: 	[HPDD-discuss] [PATCH 01/12] staging: lustre: fid: Use !x to 
check for kzalloc failure
Date: 	Sat, 20 Jun 2015 18:58:59 +0200
From: 	Julia Lawall <Julia.Lawall@lip6.fr>
To: 	Oleg Drokin <oleg.drokin@intel.com>
CC: 	<devel@driverdev.osuosl.org>, Greg Kroah-Hartman 
<gregkh@linuxfoundation.org>, <kernel-janitors@vger.kernel.org>, 
<linux-kernel@vger.kernel.org>, <HPDD-discuss@lists.01.org>



!x is more normal for kzalloc failure in the kernel.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x;
statement S1, S2;
@@

x = kzalloc(...);
if (
- x == NULL
+ !x
  ) S1 else S2
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
  drivers/staging/lustre/lustre/fid/fid_request.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -498,11 +498,11 @@ int client_fid_init(struct obd_device *o
  	int rc;
  
  	cli->cl_seq = kzalloc(sizeof(*cli->cl_seq), GFP_NOFS);
-	if (cli->cl_seq == NULL)
+	if (!cli->cl_seq)
  		return -ENOMEM;
  
  	prefix = kzalloc(MAX_OBD_NAME + 5, GFP_NOFS);
-	if (prefix == NULL) {
+	if (!prefix) {
  		rc = -ENOMEM;
  		goto out_free_seq;
  	}

_______________________________________________
HPDD-discuss mailing list
HPDD-discuss at lists.01.org
https://lists.01.org/mailman/listinfo/hpdd-discuss



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20150622/efb39765/attachment.htm>

  reply	other threads:[~2015-06-22 15:46 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-20 16:58 [PATCH 00/12] Use !x to check for kzalloc failure Julia Lawall
2015-06-20 16:58 ` Julia Lawall
2015-06-20 16:58 ` [PATCH 01/12] staging: lustre: fid: " Julia Lawall
2015-06-20 16:58   ` Julia Lawall
2015-06-22 15:46   ` Patrick Farrell [this message]
2015-06-22 17:18     ` [lustre-devel] Fwd: [HPDD-discuss] " Simmons, James A.
2015-06-23  8:05     ` Dilger, Andreas
2015-06-23  8:25   ` Dilger, Andreas
2015-06-23  8:25     ` Dilger, Andreas
2015-06-23  8:25     ` [lustre-devel] " Dilger, Andreas
2015-06-23  9:23     ` Dan Carpenter
2015-06-23  9:23       ` Dan Carpenter
2015-06-23  9:23       ` [lustre-devel] " Dan Carpenter
2015-06-23  9:35       ` Julia Lawall
2015-06-23  9:35         ` Julia Lawall
2015-06-23  9:35         ` [lustre-devel] " Julia Lawall
2015-06-23  9:57         ` Dan Carpenter
2015-06-23  9:57           ` Dan Carpenter
2015-06-23  9:57           ` [lustre-devel] " Dan Carpenter
2015-06-23 10:51           ` Julia Lawall
2015-06-23 10:51             ` Julia Lawall
2015-06-23 10:51             ` [lustre-devel] " Julia Lawall
2015-06-24 20:14             ` Simmons, James A.
2015-06-24 20:14               ` Simmons, James A.
2015-06-24 20:14               ` Simmons, James A.
2015-06-23 22:03           ` Joe Perches
2015-06-23 22:03             ` Joe Perches
2015-06-23 22:03             ` [lustre-devel] " Joe Perches
2015-06-23 22:11       ` Joe Perches
2015-06-23 22:11         ` Joe Perches
2015-06-23 22:11         ` [lustre-devel] " Joe Perches
2015-06-28  6:52     ` LIBCFS_ALLOC Julia Lawall
2015-06-28  6:52       ` LIBCFS_ALLOC Julia Lawall
2015-06-28  6:52       ` [lustre-devel] LIBCFS_ALLOC Julia Lawall
2015-06-28 21:54       ` LIBCFS_ALLOC Dan Carpenter
2015-06-28 21:54         ` LIBCFS_ALLOC Dan Carpenter
2015-06-28 21:54         ` [lustre-devel] LIBCFS_ALLOC Dan Carpenter
2015-06-30 14:56         ` LIBCFS_ALLOC Simmons, James A.
2015-06-30 14:56           ` [lustre-devel] LIBCFS_ALLOC Simmons, James A.
2015-06-30 15:01           ` LIBCFS_ALLOC Julia Lawall
2015-06-30 15:01             ` LIBCFS_ALLOC Julia Lawall
2015-06-30 15:01             ` [lustre-devel] LIBCFS_ALLOC Julia Lawall
2015-07-02 22:25             ` Simmons, James A.
2015-07-02 22:25               ` Simmons, James A.
2015-07-02 22:25               ` Simmons, James A.
2015-07-03 11:52               ` Dilger, Andreas
2015-07-03 11:52                 ` Dilger, Andreas
2015-07-03 11:52                 ` Dilger, Andreas
2015-06-30 17:38           ` LIBCFS_ALLOC Dan Carpenter
2015-06-30 17:38             ` LIBCFS_ALLOC Dan Carpenter
2015-06-30 17:38             ` [lustre-devel] LIBCFS_ALLOC Dan Carpenter
2015-06-30 21:26       ` Dilger, Andreas
2015-06-30 21:26         ` Dilger, Andreas
2015-06-20 16:59 ` [PATCH 02/12] staging: lustre: fld: Use !x to check for kzalloc failure Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-20 16:59 ` [PATCH 03/12] staging: lustre: lclient: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-20 16:59 ` [PATCH 04/12] staging: lustre: ldlm: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-20 16:59 ` [PATCH 05/12] staging: lustre: lmv: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-20 16:59 ` [PATCH 06/12] staging: lustre: lov: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-20 16:59 ` [PATCH 07/12] staging: lustre: mdc: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-20 16:59 ` [PATCH 08/12] staging: lustre: mgc: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-20 16:59 ` [PATCH 09/12] staging: lustre: obdclass: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-21 10:02   ` walter harms
2015-06-21 10:02     ` walter harms
2015-06-21 10:29     ` Julia Lawall
2015-06-21 10:29       ` Julia Lawall
2015-06-21 11:58   ` walter harms
2015-06-20 16:59 ` [PATCH 10/12] staging: lustre: obdecho: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-20 16:59 ` [PATCH 11/12] staging: lustre: osc: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall
2015-06-20 16:59 ` [PATCH 12/12] staging: lustre: ptlrpc: " Julia Lawall
2015-06-20 16:59   ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55882DC7.6060802@cray.com \
    --to=paf@cray.com \
    --cc=lustre-devel@lists.lustre.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.