All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: Re: [patch] ocfs2: cleanup error handling in o2hb_alloc_hb_set()
Date: Mon, 13 Feb 2012 20:29:24 +0000	[thread overview]
Message-ID: <20120213202923.GL4141@mwanda> (raw)
In-Reply-To: <20120213200408.GA22314@dhcp-172-17-9-228.mtv.corp.google.com>

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

On Mon, Feb 13, 2012 at 12:04:09PM -0800, Joel Becker wrote:
> On Mon, Feb 13, 2012 at 04:50:47PM +0300, Dan Carpenter wrote:
> > If "ret" is NULL, then "hs" is also NULL, so there is no need to free
> > it.  config_group_init_type_name() can't fail if the name ("heartbeat"
> > in this case) is less than CONFIGFS_ITEM_NAME_LEN (20) characters long
> > so we can just remove this error handling code.
> 
> 	Is there a problem we're fixing here?  We can make all sorts of
> arguments about single-exit functions vs immediate returns, but if there
> isn't a problem, I'm not sure what we gain by code churn.

It's a static checker thing.  It's either an unneeded NULL check or
a check on the wrong variable depending on how you look at it.
Recently, I've been sending a lot of patches to remove unneeded NULL
checks for static checkers.  I try to fix the mistakes that are
harmless so that the real bugs aren't drowned out in noise.

regards,
dan carpenter


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [patch] ocfs2: cleanup error handling in o2hb_alloc_hb_set()
Date: Mon, 13 Feb 2012 20:27:32 -0000	[thread overview]
Message-ID: <20120213202923.GL4141@mwanda> (raw)
In-Reply-To: <20120213200408.GA22314@dhcp-172-17-9-228.mtv.corp.google.com>

On Mon, Feb 13, 2012 at 12:04:09PM -0800, Joel Becker wrote:
> On Mon, Feb 13, 2012 at 04:50:47PM +0300, Dan Carpenter wrote:
> > If "ret" is NULL, then "hs" is also NULL, so there is no need to free
> > it.  config_group_init_type_name() can't fail if the name ("heartbeat"
> > in this case) is less than CONFIGFS_ITEM_NAME_LEN (20) characters long
> > so we can just remove this error handling code.
> 
> 	Is there a problem we're fixing here?  We can make all sorts of
> arguments about single-exit functions vs immediate returns, but if there
> isn't a problem, I'm not sure what we gain by code churn.

It's a static checker thing.  It's either an unneeded NULL check or
a check on the wrong variable depending on how you look at it.
Recently, I've been sending a lot of patches to remove unneeded NULL
checks for static checkers.  I try to fix the mistakes that are
harmless so that the real bugs aren't drowned out in noise.

regards,
dan carpenter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
Url : http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20120213/6d28e7b2/attachment-0001.bin 

  reply	other threads:[~2012-02-13 20:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-13 13:50 [patch] ocfs2: cleanup error handling in o2hb_alloc_hb_set() Dan Carpenter
2012-02-13 13:50 ` [Ocfs2-devel] " Dan Carpenter
2012-02-13 19:39 ` Sunil Mushran
2012-02-13 19:39   ` [Ocfs2-devel] " Sunil Mushran
2012-02-13 20:06   ` Dan Carpenter
2012-02-13 20:08     ` Dan Carpenter
2012-02-13 20:17     ` Sunil Mushran
2012-02-13 20:17       ` [Ocfs2-devel] " Sunil Mushran
2012-04-17 21:13     ` [Ocfs2-devel] Ocfs2 + Quota! Marek Królikowski
2012-02-13 20:04 ` [patch] ocfs2: cleanup error handling in o2hb_alloc_hb_set() Joel Becker
2012-02-13 20:04   ` [Ocfs2-devel] " Joel Becker
2012-02-13 20:27   ` Dan Carpenter [this message]
2012-02-13 20:29     ` Dan Carpenter
2012-02-13 20:41     ` Sunil Mushran
2012-02-13 20:41       ` [Ocfs2-devel] " Sunil Mushran

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=20120213202923.GL4141@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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.