Re: [V9fs-developer] [Patch] Dead code in fs/9p/vfs_inode.c

From: David Leimbach
Date: Wed Jun 28 2006 - 23:56:41 EST


On 6/28/06, Eric Sesterhenn / Snakebyte <snakebyte@xxxxxx> wrote:
* Russ Cox (rsc@xxxxxxxxx) wrote:
> >coverity (id #971) found some dead code. In all error
> >cases ret is NULL, so we can remove the if statement.
> >
> >Signed-off-by: Eric Sesterhenn <snakebyte@xxxxxx>
> >
> >--- linux-2.6.17-git11/fs/9p/vfs_inode.c.orig 2006-06-29
> >00:50:53.000000000 +0200
> >+++ linux-2.6.17-git11/fs/9p/vfs_inode.c 2006-06-29
> >00:51:11.000000000 +0200
> >@@ -386,9 +386,6 @@ v9fs_inode_from_fid(struct v9fs_session_
> >
> > error:
> > kfree(fcall);
> >- if (ret)
> >- iput(ret);
> >-
> > return ERR_PTR(err);
> > }
>
> What about when someone changes the code and does have ret != NULL here?
> This seems like reasonable defensive programming to me.
>
> Is the official LK policy that we can't have code that trips coverity
> checks like this?

If this is whats agreed upon I will no longer send patches for
such bugs, and mark them as ignore in the coverity system.
But I guess it makes also sense to remove unused code, because I
am not sure if gcc can figure out to remove it. In this case
the generated object file is 10 bytes smaller.

Eric


I wonder if anyone cares about those 10 bytes more than the fact that
the code that generates them is written in a defensive manner. :-)

I'd be willing to give up 10 bytes to know that if things changed in
the future that check is still there :-)

Seems like a fairly meaningless optimization to me. No offense
intended toward Eric/Snakebyte, just that sometimes things that seem
like they are optimizations and fixes end up not being either.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/